const DemoApp = angular.module('DemoApp', ['dx']);
DemoApp.controller('DemoController', ($scope) => {
$scope.passwordMode = 'password';
$scope.changePasswordMode = function () {
if ($scope.passwordMode === 'text') {
$scope.passwordMode = 'password';
} else {
$scope.passwordMode = 'text';
}
};
$scope.format = '$ #.##';
$scope.priceValue = 14500.55;
$scope.currencyOnInitialized = function (e) {
$scope.currencyInstance = e.component;
};
$scope.changeCurrency = function () {
if ($scope.currencyInstance.option('text') === '$') {
$scope.currencyInstance.option('text', '€');
$scope.format = '$ #.##';
$scope.priceValue /= 0.836;
} else {
$scope.currencyInstance.option('text', '$');
$scope.format = '€ #.##';
$scope.priceValue *= 0.836;
}
};
const millisecondsInDay = 24 * 60 * 60 * 1000;
$scope.currentDate = new Date().getTime();
$scope.today = function () {
$scope.currentDate = new Date().getTime();
};
$scope.nextDate = function () {
$scope.currentDate += millisecondsInDay;
};
$scope.prevDate = function () {
$scope.currentDate -= millisecondsInDay;
};
});
<!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>
<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-field">
<div class="dx-field-label">Password TextBox</div>
<div class="dx-field-value">
<div
dx-text-box="{
placeholder: 'password',
mode: 'password',
value: 'password',
stylingMode: 'filled',
bindingOptions: {
mode: 'passwordMode'
},
buttons: [{
name: 'show-password',
location: 'after',
options: {
icon: '../../../../images/icons/eye.png',
type: 'default',
onClick: changePasswordMode
}
}]
}"
></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Multi-currency NumberBox</div>
<div class="dx-field-value">
<div
dx-number-box="{
bindingOptions: {
format: 'format',
value: 'priceValue'
},
showClearButton: true,
showSpinButtons: true,
buttons: [{
name: 'currency',
location: 'after',
options: {
text: '€',
stylingMode: 'text',
width: 32,
elementAttr: {
class: 'currency'
},
onInitialized: currencyOnInitialized,
onClick: changeCurrency
}
}, 'clear', 'spins']
}"
></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Advanced DateBox</div>
<div class="dx-field-value">
<div
dx-date-box="{
bindingOptions: {
value: 'currentDate'
},
stylingMode: 'outlined',
buttons: [{
name: 'today',
location: 'before',
options: {
text: 'Today',
onClick: today
}
}, {
name: 'prevDate',
location: 'before',
options: {
icon: 'spinprev',
stylingMode: 'text',
onClick: prevDate
}
}, {
name: 'nextDate',
location: 'after',
options: {
icon: 'spinnext',
stylingMode: 'text',
onClick: nextDate
}
}, 'dropDown']
}"
></div>
</div>
</div>
</div>
</div>
</body>
</html>
.dx-fieldset {
min-height: 560px;
width: 560px;
margin: 0 auto;
}
.currency {
min-width: 32px;
}
.dx-button.currency .dx-button-content {
font-size: 120%;
padding-left: 5px;
padding-right: 5px;
}