Module that add popup dialog box to your application
This module has some cool UX functionality:
- it will set focus on OK in simple alert popup
- it will focus on input if you have one in the popup (will work in confirmation popup only)
angular (required)
angular-sanitize (required)
bootstrap (optional)
less (optional)
Add to your project
var app = angular.module('app', ['artemdemo.popup']);
Added reference to your controller
app.controller('mainCtrl', ['$popup', function($popup){
// Your code here
}]);
Simple popup
$popup.show({
title: 'Alert',
template: 'Example #1',
okText: 'OK button text',
okType: ''
});
Confirmation popup
$popup.confirm({
title: 'Confirm',
template: 'Example #2',
okText: 'OK',
cancelText: 'Cancel'
});
Confirmation popup with input
$popup.confirm({
title: 'Confirm',
template: '<input type="text" ng-model="inputValue" />',
scope: $scope,
okText: 'OK',
cancelText: 'Cancel',
okTap: function(e) {
// template scope will be available via 'this'
return this.inputValue;
}
}).then(function( value ){
$timeout(function(){
$popup.show({
title: 'Alert',
template: value,
okText: 'OK',
okType: ''
});
}, 200);
});