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
+51-4
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,12 @@
1
1
AngularJS-Toaster
2
2
=================
3
3
4
-
**AngularJS Toaster** is an AngularJS port of the **toastr** non-blocking notification jQuery library. It requires AngularJS v1.2.6 or higher and angular-animate for the CSS3 transformations.
5
-
(I would suggest to use /1.2.8/angular-animate.js, there is a weird blinking in newer versions.)
4
+
**AngularJS Toaster** is an AngularJS port of the **toastr** non-blocking notification jQuery library. It requires AngularJS v1.2.6 or higher and angular-animate for the CSS3 transformations.
@@ -130,6 +129,8 @@ There are four types of body renderings: trustedHtml', 'template', 'templateWith
130
129
131
130
- directive
132
131
- Will use the `toast.body` argument to represent the name of a directive that you want to render as the toast's body, else it will fallback to the template bound to the `'body-template': 'toasterBodyTmpl.html'` configuration option.
132
+
The directive name being passed to the `body` argument should be normalized as it exists in the markup,
133
+
not camelCased as it would appear in the directive declaration (`cool-directive-name` instead of `coolDirectiveName`).
133
134
134
135
```js
135
136
// The toast pop call, passing in a directive name to be rendered
@@ -148,7 +149,7 @@ There are four types of body renderings: trustedHtml', 'template', 'templateWith
148
149
};
149
150
}])
150
151
```
151
-
- Will use the `toast.directiveData` argument to accept data that will be bound to the directive's scope.
152
+
- Will use the `toast.directiveData` argument to accept data that will be bound to the directive's scope.
152
153
153
154
```js
154
155
// The toast pop call, passing in a directive name to be rendered
@@ -206,6 +207,37 @@ toaster.pop({
206
207
});
207
208
```
208
209
210
+
### Multiple Toaster Containers
211
+
If desired, you can include multiple `<toaster-container></toaster-container>`
212
+
elements in your DOM. The library will register an event handler for every instance
213
+
of the container that it identifies. By default, when there are multiple registered
214
+
containers, each container will receive a toast notification and display it when a toast
215
+
is popped.
216
+
217
+
To target a specific container, you need to register that container with a unique `toaster-id`.
If you do not want to use animations, you can safely remove the angular-animate.min.js reference as well as the injection of ngAnimate. Toasts will be displayed without animations.
225
257
258
+
259
+
### Common Issues
260
+
- Toaster always shows up as "info"
261
+
- Your `<toaster-container></toaster-container` might be placed inside of your routing directive.
262
+
- You have multiple `<toaster-container></toaster-container` elements without unqiue `toaster-id` configuration arguments.
263
+
-[$sce:itype] Attempted to trust a non-string value in a content requiring a string
264
+
- You have not specified: `bodyOutputType: 'trustedHtml'` when passing html as a body argument.
265
+
- My toasts do not show up when I pop them, but after I perform another action.
266
+
- You are calling `toaster.pop()` outside of AngularJS scope and a digest cycle is not being triggered.
267
+
Wrap your `toaster.pop()` call in `$timeout` to force a digest cycle.
0 commit comments