angular-material-npfixed
Version:
The Angular Material project is an implementation of Material Design in Angular.js. This project provides a set of reusable, well-tested, and accessible Material Design UI components. Angular Material is supported internally at Google by the Angular.js, M
50 lines (40 loc) • 1.15 kB
JavaScript
angular.module('dialogDemo3', ['ngMaterial'])
.config(function ($mdThemingProvider) {
$mdThemingProvider.theme('red')
.primaryPalette('red');
$mdThemingProvider.theme('blue')
.primaryPalette('blue');
})
.controller('AppCtrl', function($scope, $mdDialog, $interval) {
$scope.theme = 'red';
var isThemeRed = true;
$interval(function () {
$scope.theme = isThemeRed ? 'blue' : 'red';
isThemeRed = !isThemeRed;
}, 2000);
$scope.showAdvanced = function(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'dialog1.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
clickOutsideToClose:true
})
.then(function(answer) {
$scope.status = 'You said the information was "' + answer + '".';
}, function() {
$scope.status = 'You cancelled the dialog.';
});
};
function DialogController($scope, $mdDialog) {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
}
});