Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. angular.module('priooo')
  2. /* @ngInject */
  3. .service('SweetAlert', function() {
  4. this.defaultSettings = {
  5. confirmButtonColor: "#449d44"
  6. };
  7. this.Input = function(option, callback) {
  8. var options = angular.copy(this.defaultSettings);
  9. options.showCancelButton = true;
  10. options.type = "input";
  11. for(x in option) options[x] = option[x];
  12.  
  13. if($('.confirm-all')) $('.confirm-all').remove();
  14. swal(options, callback);
  15. };
  16. this.Confirm = function(option, callback) {
  17. var options = angular.copy(this.defaultSettings);
  18. options.showCancelButton = true;
  19. options.type = "warning";
  20. options.title = "Are you sure?";
  21. for(x in option) options[x] = option[x];
  22.  
  23. if($('.confirm-all')) $('.confirm-all').remove();
  24. swal(options, callback);
  25. };
  26. this.Info = function(option, callback) {
  27. var options = angular.copy(this.defaultSettings);
  28. options.type = "info";
  29. for(x in option) options[x] = option[x];
  30.  
  31. if($('.confirm-all')) $('.confirm-all').remove();
  32. swal(options, callback);
  33. };
  34. this.Success = function(option, callback) {
  35. var options = angular.copy(this.defaultSettings);
  36. options.type = "success";
  37. for(x in option) options[x] = option[x];
  38.  
  39. if($('.confirm-all')) $('.confirm-all').remove();
  40. swal(options, callback);
  41. };
  42. this.Warning = function(option, callback) {
  43. var options = angular.copy(this.defaultSettings);
  44. options.type = "warning";
  45. for(x in option) options[x] = option[x];
  46.  
  47. if($('.confirm-all')) $('.confirm-all').remove();
  48. swal(options, callback);
  49. };
  50. this.Error = function(option, callback) {
  51. var options = angular.copy(this.defaultSettings);
  52. options.type = "error";
  53. for(x in option) options[x] = option[x];
  54.  
  55. if($('.confirm-all')) $('.confirm-all').remove();
  56. swal(options, callback);
  57. };
  58. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement