Skip to content

Commit 465b6a8

Browse files
committed
Merge pull request #201 from Stabzs/master
Updated documentation
2 parents e8e074b + 8a66010 commit 465b6a8

File tree

4 files changed

+68
-20
lines changed

4 files changed

+68
-20
lines changed

README.md

+63-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AngularJS-Toaster
66
[![Build Status](https://travis-ci.org/jirikavi/AngularJS-Toaster.svg)](https://travis-ci.org/jirikavi/AngularJS-Toaster)
77
[![Coverage Status](https://coveralls.io/repos/jirikavi/AngularJS-Toaster/badge.svg?branch=master&service=github&busting=3)](https://coveralls.io/github/jirikavi/AngularJS-Toaster?branch=master)
88

9-
### Current Version 1.2.0
9+
### Current Version 1.2.1
1010

1111
## Angular Compatibility
1212
AngularJS-Toaster requires AngularJS v1.2.6 or higher and specifically targets AngularJS, not Angular 2, although it could be used via ngUpgrade.
@@ -64,6 +64,39 @@ angular.module('main', ['toaster', 'ngAnimate'])
6464
</div>
6565
```
6666

67+
### Timeout
68+
By default, toasts have a timeout setting of 5000, meaning that they are removed after 5000
69+
milliseconds.
70+
71+
If the timeout is set to anything other than a number greater than 0, the toast will be considered
72+
"sticky" and will not automatically dismiss.
73+
74+
The timeout can be configured at three different levels:
75+
76+
* Globally in the config for all toast types:
77+
```html
78+
<toaster-container toaster-options="{'time-out': 1000}"></toaster-container>
79+
```
80+
81+
* Per info-class type:
82+
By passing the time-out configuration as an object instead of a number, you can specify the global behavior an info-class type should have.
83+
```html
84+
<toaster-container toaster-options="
85+
{'time-out':{ 'toast-warning': 10, 'toast-error': 0 } }">
86+
</toaster-container>
87+
```
88+
If a type is not defined and specified, a timeout will not be applied, making the toast "sticky".
89+
90+
* Per toast constructed via toaster.pop('success', "title", "text"):
91+
```html
92+
toaster.pop({
93+
type: 'error',
94+
title: 'Title text',
95+
body: 'Body text',
96+
timeout: 3000
97+
});
98+
```
99+
67100
### Close Button
68101

69102
The Close Button's visibility can be configured at three different levels:
@@ -260,6 +293,35 @@ vm.popContainerTwo = function () {
260293
and it is documented in these [tests](test/toasterContainerSpec.js#L430).
261294

262295

296+
### Limit
297+
Limit is defaulted to 0, meaning that there is no maximum number of toasts that are defined
298+
before the toast container begins removing toasts when a new toast is added.
299+
300+
To change this behavior, pass a "limit" option to the toast-container configuration:
301+
302+
```html
303+
<toaster-container toaster-options="{'limit':5}"></toaster-container>
304+
```
305+
306+
### Dismiss on tap
307+
By default, the `tap-to-dismiss` option is set to true, meaning that if a toast is clicked anywhere
308+
on the toast body, the toast will be dismissed. This behavior can be overriden in the toast-container
309+
configuration so that if set to false, the toast will only be dismissed if the close button is defined
310+
and clicked:
311+
312+
```html
313+
<toaster-container toaster-options="{'tap-to-dismiss':false}"></toaster-container>
314+
```
315+
316+
### Newest Toasts on Top
317+
The `newest-on-top` option is defaulted to true, adding new toasts on top of other existing toasts.
318+
If changed to false via the toaster-container configuration, toasts will be added to the bottom of
319+
other existing toasts.
320+
321+
```html
322+
<toaster-container toaster-options="{'newest-on-top':false}"></toaster-container>
323+
```
324+
263325
### Other Options
264326

265327
```html

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-toaster",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "AngularJS Toaster is a customized version of toastr non-blocking notification javascript library",
55
"author": "Jiri Kavulak",
66
"license": "MIT",

toaster.js

+3-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/*
66
* AngularJS Toaster
7-
* Version: 1.2.0
7+
* Version: 1.2.1
88
*
99
* Copyright 2013-2016 Jiri Kavulak.
1010
* All Rights Reserved.
@@ -19,24 +19,10 @@
1919
'toasterConfig', {
2020
'limit': 0, // limits max number of toasts
2121
'tap-to-dismiss': true,
22-
23-
/* Options:
24-
- Boolean false/true
25-
'close-button': true
26-
- object if not a boolean that allows you to
27-
override showing the close button for each
28-
icon-class value
29-
'close-button': { 'toast-error': true, 'toast-info': false }
30-
*/
3122
'close-button': false,
3223
'close-html': '<button class="toast-close-button" type="button">&times;</button>',
33-
'newest-on-top': true,
34-
//'fade-in': 1000, // done in css
35-
//'on-fade-in': undefined, // not implemented
36-
//'fade-out': 1000, // done in css
37-
//'on-fade-out': undefined, // not implemented
38-
//'extended-time-out': 1000, // not implemented
39-
'time-out': 5000, // Set timeOut and extendedTimeout to 0 to make it sticky
24+
'newest-on-top': true,
25+
'time-out': 5000,
4026
'icon-classes': {
4127
error: 'toast-error',
4228
info: 'toast-info',

toaster.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)