@@ -4,7 +4,12 @@ angular.module('growlNotifications.services')
4
4
// Default options
5
5
var options = {
6
6
ttl : 5000 ,
7
- type : 'info'
7
+ type : 'info' ,
8
+
9
+ // Default css prefix that is used to construct growl css classes
10
+ // 2 classes will be added: cssPrefix and cssPrefix-type to support
11
+ // Bootstrap alerts out of the box
12
+ cssPrefix : 'alert'
8
13
} ;
9
14
10
15
/**
@@ -25,10 +30,10 @@ angular.module('growlNotifications.services')
25
30
*/
26
31
this . ttl = function ( ttl ) {
27
32
if ( angular . isDefined ( ttl ) ) {
28
- this . options . ttl = ttl ;
33
+ options . ttl = ttl ;
29
34
return this ;
30
35
}
31
- return this . options . ttl ;
36
+ return options . ttl ;
32
37
} ;
33
38
34
39
/**
@@ -39,10 +44,24 @@ angular.module('growlNotifications.services')
39
44
*/
40
45
this . type = function ( type ) {
41
46
if ( angular . isDefined ( type ) ) {
42
- this . options . type = type ;
47
+ options . type = type ;
48
+ return this ;
49
+ }
50
+ return options . type ;
51
+ } ;
52
+
53
+ /**
54
+ * Provider convenience method to get or set default type
55
+ *
56
+ * @param type
57
+ * @returns {* }
58
+ */
59
+ this . cssPrefix = function ( cssPrefix ) {
60
+ if ( angular . isDefined ( cssPrefix ) ) {
61
+ options . cssPrefix = cssPrefix ;
43
62
return this ;
44
63
}
45
- return this . options . type ;
64
+ return options . cssPrefix ;
46
65
} ;
47
66
48
67
/**
@@ -59,6 +78,8 @@ angular.module('growlNotifications.services')
59
78
this . _notifications = { } ;
60
79
this . _index = 0 ;
61
80
81
+ this . options = options ;
82
+
62
83
Object . defineProperty ( this , 'notifications' , {
63
84
get : function ( ) {
64
85
return this . _notifications ;
0 commit comments