const DemoApp = angular.module('DemoApp', ['dx']);
DemoApp.controller('DemoController', ($scope) => {
const valueChangeEvents = [{
title: 'On Blur',
name: 'change',
}, {
title: 'On Key Up',
name: 'keyup',
}];
$scope.maxLength = null;
$scope.value = longText;
$scope.eventValue = valueChangeEvents[0].name;
$scope.valueForEditableTextArea = longText;
$scope.height = 90;
$scope.autoResizeEnabled = false;
$scope.textAreaWithMaxLength = {
height: 90,
bindingOptions: {
maxLength: 'maxLength',
value: 'value',
autoResizeEnabled: 'autoResizeEnabled',
},
};
$scope.checkBoxOptions = {
value: false,
onValueChanged(data) {
$scope.value = data.value ? longText.substring(0, 100) : longText;
$scope.maxLength = data.value ? 100 : null;
},
text: 'Limit text length',
};
$scope.autoResizeCheckBoxOptions = {
text: 'Enable auto resize',
onValueChanged(e) {
$scope.autoResizeEnabled = e.value;
$scope.height = e.value ? undefined : 90;
},
bindingOptions: {
value: 'autoResizeEnabled',
},
};
$scope.selectBoxOptions = {
items: valueChangeEvents,
valueExpr: 'name',
displayExpr: 'title',
bindingOptions: {
value: 'eventValue',
},
};
$scope.editableTextArea = {
height: 90,
bindingOptions: {
value: 'valueForEditableTextArea',
valueChangeEvent: 'eventValue',
},
};
$scope.disabledTextArea = {
height: 90,
readOnly: true,
bindingOptions: {
value: 'valueForEditableTextArea',
},
};
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/22.2.6/css/dx.light.css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script>
<script src="https://cdn3.devexpress.com/jslib/22.2.6/js/dx.all.js"></script>
<script src="data.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="index.js"></script>
</head>
<body class="dx-viewport">
<div class="demo-container" ng-app="DemoApp" ng-controller="DemoController">
<div class="dx-fieldset">
<div class="dx-fieldset-header">Default Mode</div>
<div class="dx-field">
<div dx-check-box="checkBoxOptions"></div>
</div>
<div class="dx-field">
<div dx-check-box="autoResizeCheckBoxOptions"></div>
</div>
</div>
<div class="left-content">
<div dx-text-area="textAreaWithMaxLength"></div>
</div>
<div class="full-width-content">
<div class="dx-fieldset">
<div class="dx-fieldset-header">Event Handling and API</div>
<div class="dx-field">
<div class="dx-field-label">Synchronize text areas </div>
<div class="dx-field-value">
<div dx-select-box="selectBoxOptions"></div>
</div>
</div>
</div>
<div dx-text-area="editableTextArea"></div>
<div dx-text-area="disabledTextArea"></div>
</div>
</div>
</body>
</html>
.full-width-content {
width: 100%;
margin-top: 30px;
}
.full-width-content > .dx-widget {
margin-bottom: 20px;
}
.full-width-content .dx-field {
max-width: 385px;
}
const longText = 'Prepare 2013 Marketing Plan: We need to double revenues in 2013 and our marketing strategy is going to be key here. R&D is improving existing products and creating new products so we can deliver great AV equipment to our customers.Robert, please make certain to create a PowerPoint presentation for the members of the executive team.';