forked from dev-tim/angular-noty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-noty.js
40 lines (33 loc) · 933 Bytes
/
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, $) {
return angular.module('notyModule', []).provider('noty', function () {
var settings = $.noty.defaults;
return {
settings: settings,
$get: function () {
var callNoty = function (newSettings) {
return noty(newSettings || {});
};
return {
show: function (message, type) {
callNoty({text: message || settings.text, type: type || settings.type});
},
showAlert: function (message) {
callNoty({text: message || settings.text, type: "alert"});
},
showSuccess: function (message) {
callNoty({text: message || settings.text, type: "success"});
},
showError: function (message) {
callNoty({text: message, type: "error"});
},
closeAll: function () {
return $.noty.closeAll()
},
clearShowQueue: function () {
return $.noty.clearQueue();
}.bind(this)
}
}
};
})
}(angular, jQuery));