You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-51Lines changed: 37 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,8 +37,6 @@ $ bower install angular-toastr
37
37
38
38
## Usage
39
39
40
-
### Basic usage
41
-
42
40
Toastr usage is very simple, by default it comes with four types of notification messages:
43
41
44
42
Success:
@@ -109,35 +107,57 @@ A toast has a `isOpened` flag to see whether it is opened or not.
109
107
110
108
### Toastr customization
111
109
112
-
You can customize the entire library like:
110
+
This library has two parts, a `container` and the `toasts` you put in it.
111
+
112
+
To configure the `container` you need to modify the `toastrConfig`, for example:
113
113
114
114
```javascript
115
115
app.config(function(toastrConfig) {
116
116
angular.extend(toastrConfig, {
117
-
allowHtml:false,
118
117
autoDismiss:false,
118
+
containerId:'toast-container',
119
+
maxOpened:0,
120
+
newestOnTop:true,
121
+
positionClass:'toast-top-right',
122
+
preventDuplicates:false,
123
+
preventOpenDuplicates:false,
124
+
target:'body'
125
+
});
126
+
});
127
+
```
128
+
129
+
Those are the default values, you can pick what you need from it and override with your values.
130
+
131
+
***autoDismiss** If set, show only the most recent `maxOpened` toast(s)
132
+
***containerId**: The name of the container where you want to append your toasts (the container will be created for you).
133
+
***maxOpened**: Maximum number of toasts displayed at once.
134
+
***newestOnTop**: Add new toasts on top of the old one. Put on false to put them on the bottom.
135
+
***positionClass**: The position where the toasts are added.
136
+
***preventDuplicates**: Prevent duplicates of the last toast.
137
+
***preventOpenDuplicates**: Prevent duplicates of open toasts.
138
+
***target**: The element to put the toastr container.
139
+
140
+
To customize a `toast` you have two options. First, you can set a default option to be applied globally to all `toasts` in the same way you modified the `container`:
0 commit comments