-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathangular-noty.js
40 lines (34 loc) · 1.02 KB
/
angular-noty.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function (angular, $) {
'use strict';
return angular.module('notyModule', []).provider('noty', function () {
var provider = {
settings: $.noty.defaults,
$get: function () {
var callNoty = function (newSettings) {
return noty(angular.extend({}, provider.settings, newSettings));
};
return {
show: function (message, type) {
callNoty({text: message || provider.settings.text, type: type || provider.settings.type});
},
showAlert: function (message) {
callNoty({text: message || provider.settings.text, type: "warning"});
},
showSuccess: function (message) {
callNoty({text: message || provider.settings.text, type: "success"});
},
showError: function (message) {
callNoty({text: message || provider.settings.text, type: "error"});
},
closeAll: function () {
return $.noty.closeAll();
},
clearShowQueue: function () {
return $.noty.clearQueue();
}.bind(this)
};
}
};
return provider;
});
}(angular, jQuery));