apollo_developers/bower_components/angular-sweetalert-promised/SweetAlert.js
venbatechnologies@gmail.com 1809bcf9c9 fixed table for student details
2018-04-23 18:34:11 +05:30

71 lines
1.3 KiB
JavaScript
Executable File

/**
@fileOverview
@toc
*/
'use strict';
angular.module('oitozero.ngSweetAlert', [])
.factory('SweetAlert', [ '$timeout', '$window', function ( $timeout, $window ) {
var swal = $window.swal;
//public methods
var self = {
swal: function ( arg1, arg2, arg3 ) {
$timeout(function(){
if( typeof(arg2) === 'function' ) {
swal( arg1, function(isConfirm){
$timeout( function(){
arg2(isConfirm);
});
}, arg3 );
} else {
swal( arg1, arg2, arg3 );
}
}, 200);
},
adv: function( object ) {
$timeout(function() {
swal( object );
}, 200);
},
timed: function( title, message, type, time ) {
$timeout(function() {
swal( {
title: title,
text: message,
type: type,
timer: time
} );
}, 200);
},
success: function(title, message) {
$timeout(function(){
swal( title, message, 'success' );
}, 200);
},
error: function(title, message) {
$timeout(function(){
swal( title, message, 'error' );
}, 200);
},
warning: function(title, message) {
$timeout(function(){
swal( title, message, 'warning' );
}, 200);
},
info: function(title, message) {
$timeout(function(){
swal( title, message, 'info' );
}, 200);
}
};
return self;
}]);