Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('priooo')
- /* @ngInject */
- .service('SweetAlert', function() {
- this.defaultSettings = {
- confirmButtonColor: "#449d44"
- };
- this.Input = function(option, callback) {
- var options = angular.copy(this.defaultSettings);
- options.showCancelButton = true;
- options.type = "input";
- for(x in option) options[x] = option[x];
- if($('.confirm-all')) $('.confirm-all').remove();
- swal(options, callback);
- };
- this.Confirm = function(option, callback) {
- var options = angular.copy(this.defaultSettings);
- options.showCancelButton = true;
- options.type = "warning";
- options.title = "Are you sure?";
- for(x in option) options[x] = option[x];
- if($('.confirm-all')) $('.confirm-all').remove();
- swal(options, callback);
- };
- this.Info = function(option, callback) {
- var options = angular.copy(this.defaultSettings);
- options.type = "info";
- for(x in option) options[x] = option[x];
- if($('.confirm-all')) $('.confirm-all').remove();
- swal(options, callback);
- };
- this.Success = function(option, callback) {
- var options = angular.copy(this.defaultSettings);
- options.type = "success";
- for(x in option) options[x] = option[x];
- if($('.confirm-all')) $('.confirm-all').remove();
- swal(options, callback);
- };
- this.Warning = function(option, callback) {
- var options = angular.copy(this.defaultSettings);
- options.type = "warning";
- for(x in option) options[x] = option[x];
- if($('.confirm-all')) $('.confirm-all').remove();
- swal(options, callback);
- };
- this.Error = function(option, callback) {
- var options = angular.copy(this.defaultSettings);
- options.type = "error";
- for(x in option) options[x] = option[x];
- if($('.confirm-all')) $('.confirm-all').remove();
- swal(options, callback);
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement