@@ -40,7 +40,7 @@ The following list describes the compatibility with Angular:
4040| ` 5.x ` | ` 7.x ` |
4141| ` 6.x ` | ` 8.x ` |
4242| ` 7.x ` | ` 9.x ` |
43- | ` 8.x ` | ` 10.x ` |
43+ | ` 8.x ` | ` 10.x ` |
4444
4545<br >
4646
@@ -49,11 +49,11 @@ The following list describes the compatibility with Angular:
4949By default, meaning without any polyfills, ** angular-notifier** is compatible with ** the latest versions of Chrome, Firefox, and Opera** .
5050Bringing in the following polyfills will improve browser support:
5151
52- - To be able to use the latest and greatest JavaScript features in older browsers (e.g. older version of IE & Safari), you might want to
53- add ** [ core-js] ( https://github.com/zloirock/core-js ) ** to your polyfills.
54- - For animation support (in particular, for better
55- ** [ Web Animations API] ( https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API ) ** support), you might want to use the ** [ web-animations-js] ( https://github.com/web-animations/web-animations-js ) ** polyfill. For details, see the corresponding
56- ** [ CanIUse page] ( http://caniuse.com/#feat=web-animation ) ** .
52+ - To be able to use the latest and greatest JavaScript features in older browsers (e.g. older version of IE & Safari), you might want to
53+ add ** [ core-js] ( https://github.com/zloirock/core-js ) ** to your polyfills.
54+ - For animation support (in particular, for better
55+ ** [ Web Animations API] ( https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API ) ** support), you might want to use the ** [ web-animations-js] ( https://github.com/web-animations/web-animations-js ) ** polyfill. For details, see the corresponding
56+ ** [ CanIUse page] ( http://caniuse.com/#feat=web-animation ) ** .
5757
5858> For detailed information about the Angular browser support read the
5959> ** [ official Angular browser support documentation] ( https://angular.io/docs/ts/latest/guide/browser-support.html ) ** . If you generated your
@@ -75,10 +75,10 @@ First of all, make **angular-notifier** globally available to your Angular appli
7575` NotifierModule ` the your root Angular module. For example:
7676
7777``` typescript
78- import { NotifierModule } from " angular-notifier" ;
78+ import { NotifierModule } from ' angular-notifier' ;
7979
8080@NgModule ({
81- imports: [NotifierModule ]
81+ imports: [NotifierModule ],
8282})
8383export class AppModule {}
8484```
@@ -87,14 +87,14 @@ But wait -- your probably might want to customize your notifications' look and b
8787call the ` withConfig ` method on the ` NotifierModule ` , and pass in the options. For example:
8888
8989``` typescript
90- import { NotifierModule } from " angular-notifier" ;
90+ import { NotifierModule } from ' angular-notifier' ;
9191
9292@NgModule ({
93- imports: [
94- NotifierModule .withConfig ({
95- // Custom options in here
96- })
97- ]
93+ imports: [
94+ NotifierModule .withConfig ({
95+ // Custom options in here
96+ }),
97+ ],
9898})
9999export class AppModule {}
100100```
@@ -108,11 +108,11 @@ root (app) component. For example:
108108
109109``` typescript
110110@Component ({
111- selector: " my-app" ,
112- template: `
113- <h1>Hello World</h1>
114- <notifier-container></notifier-container>
115- `
111+ selector: ' my-app' ,
112+ template: `
113+ <h1>Hello World</h1>
114+ <notifier-container></notifier-container>
115+ ` ,
116116})
117117export class AppComponent {}
118118```
@@ -137,9 +137,9 @@ the themes and notification types.
137137To keep the size if your styles as small as possible (improving performance for the perfect UX), your might instead decide to only import
138138the styles actually needed by our application. The ** angular-notifier** styles are modular:
139139
140- - The ` ~/angular-notifier/styles/core.(scss|css) ` file is always required, it defines the basic styles (such as the layout)
141- - Themes can be imported from the ` ~/angular-notifier/styles/theme ` folder
142- - The different notification types, then, can be imported from the ` ~/angular-notifier/styles/types ` folder
140+ - The ` ~/angular-notifier/styles/core.(scss|css) ` file is always required, it defines the basic styles (such as the layout)
141+ - Themes can be imported from the ` ~/angular-notifier/styles/theme ` folder
142+ - The different notification types, then, can be imported from the ` ~/angular-notifier/styles/types ` folder
143143
144144<br ><br ><br >
145145
@@ -149,17 +149,17 @@ Using **angular-notifier** is as simple as it can get -- simple import and injec
149149service, ...) you want to use in. For example:
150150
151151``` typescript
152- import { NotifierService } from " angular-notifier" ;
152+ import { NotifierService } from ' angular-notifier' ;
153153
154154@Component ({
155- // ...
155+ // ...
156156})
157157export class MyAwesomeComponent {
158- private readonly notifier: NotifierService ;
158+ private readonly notifier: NotifierService ;
159159
160- constructor (notifierService : NotifierService ) {
161- this .notifier = notifierService ;
162- }
160+ constructor (notifierService : NotifierService ) {
161+ this .notifier = notifierService ;
162+ }
163163}
164164```
165165
@@ -170,18 +170,14 @@ export class MyAwesomeComponent {
170170Showing a notification is simple - all your need is a type, and a message to be displayed. For example:
171171
172172``` typescript
173- this .notifier .notify (" success" , " You are awesome! I mean it!" );
173+ this .notifier .notify (' success' , ' You are awesome! I mean it!' );
174174```
175175
176176You can further pass in a _ notification ID_ as the third (optional) argument. Essentially, such a _ notification ID_ is nothing more but a
177177unique string tha can be used later on to gain access (and thus control) to this specific notification. For example:
178178
179179``` typescript
180- this .notifier .notify (
181- " success" ,
182- " You are awesome! I mean it!" ,
183- " THAT_NOTIFICATION_ID"
184- );
180+ this .notifier .notify (' success' , ' You are awesome! I mean it!' , ' THAT_NOTIFICATION_ID' );
185181```
186182
187183> For example, you might want to define a _ notification ID_ if you know that, at some point in the future, you will need to remove _ this
@@ -191,9 +187,9 @@ this.notifier.notify(
191187
192188``` typescript
193189this .notifier .show ({
194- type: " success" ,
195- message: " You are awesome! I mean it!" ,
196- id: " THAT_NOTIFICATION_ID" // Again, this is optional
190+ type: ' success' ,
191+ message: ' You are awesome! I mean it!' ,
192+ id: ' THAT_NOTIFICATION_ID' , // Again, this is optional
197193});
198194```
199195
@@ -205,7 +201,7 @@ You can also hide notifications. To hide a specific notification - assuming you'
205201call:
206202
207203``` typescript
208- this .notifier .hide (" THAT_NOTIFICATION_ID" );
204+ this .notifier .hide (' THAT_NOTIFICATION_ID' );
209205```
210206
211207Furthermore, your can hide the newest notification by calling:
@@ -298,7 +294,7 @@ With the `theme` property you can change the overall look and feel of your notif
298294 * Defines the notification theme, responsible for the Visual Design of notifications
299295 * @type {string}
300296 */
301- theme : " material" ;
297+ theme : ' material' ;
302298```
303299
304300#### Theming in detail
@@ -362,9 +358,7 @@ You can define a custom `ng-template` as follows:
362358
363359``` html
364360<ng-template #customNotification let-notificationData =" notification" >
365- <my-custom-alert type =" notificationData.type" >
366- {{ notificationData.message }}
367- </my-custom-alert >
361+ <my-custom-alert type =" notificationData.type" > {{ notificationData.message }} </my-custom-alert >
368362</ng-template >
369363```
370364
@@ -373,23 +367,23 @@ In this case you could wrap your own HTML, even a `<my-custom-alert>` component
373367Inside your component, you can then reference the ` <ng-template> ` by its template variable ` #customNotification ` using Angular's ` ViewChild ` :
374368
375369``` typescript
376- import { ViewChild } from " @angular/core" ;
370+ import { ViewChild } from ' @angular/core' ;
377371
378372@Component ({
379- // ...
373+ // ...
380374})
381375export class SomeComponent {
382- @ViewChild (" customNotification" , { static: true }) customNotificationTmpl;
376+ @ViewChild (' customNotification' , { static: true }) customNotificationTmpl;
383377
384- constructor (private notifierService : NotifierService ) {}
378+ constructor (private notifierService : NotifierService ) {}
385379
386- showNotification() {
387- this .notifier .show ({
388- message: " Hi there!" ,
389- type: " info" ,
390- template: this .customNotificationTmpl
391- });
392- }
380+ showNotification() {
381+ this .notifier .show ({
382+ message: ' Hi there!' ,
383+ type: ' info' ,
384+ template: this .customNotificationTmpl ,
385+ });
386+ }
393387}
394388```
395389
@@ -491,43 +485,43 @@ To sum it up, the following is the default configuration _(copy-paste-friendly)_
491485
492486``` typescript
493487const notifierDefaultOptions: NotifierOptions = {
494- position: {
495- horizontal: {
496- position: " left" ,
497- distance: 12
498- },
499- vertical: {
500- position: " bottom" ,
501- distance: 12 ,
502- gap: 10
503- }
504- },
505- theme: " material" ,
506- behaviour: {
507- autoHide: 5000 ,
508- onClick: false ,
509- onMouseover: " pauseAutoHide" ,
510- showDismissButton: true ,
511- stacking: 4
512- },
513- animations: {
514- enabled: true ,
515- show: {
516- preset: " slide" ,
517- speed: 300 ,
518- easing: " ease"
519- },
520- hide: {
521- preset: " fade" ,
522- speed: 300 ,
523- easing: " ease" ,
524- offset: 50
525- },
526- shift: {
527- speed: 300 ,
528- easing: " ease"
529- },
530- overlap: 150
531- }
488+ position: {
489+ horizontal: {
490+ position: ' left' ,
491+ distance: 12 ,
492+ },
493+ vertical: {
494+ position: ' bottom' ,
495+ distance: 12 ,
496+ gap: 10 ,
497+ },
498+ },
499+ theme: ' material' ,
500+ behaviour: {
501+ autoHide: 5000 ,
502+ onClick: false ,
503+ onMouseover: ' pauseAutoHide' ,
504+ showDismissButton: true ,
505+ stacking: 4 ,
506+ },
507+ animations: {
508+ enabled: true ,
509+ show: {
510+ preset: ' slide' ,
511+ speed: 300 ,
512+ easing: ' ease' ,
513+ },
514+ hide: {
515+ preset: ' fade' ,
516+ speed: 300 ,
517+ easing: ' ease' ,
518+ offset: 50 ,
519+ },
520+ shift: {
521+ speed: 300 ,
522+ easing: ' ease' ,
523+ },
524+ overlap: 150 ,
525+ },
532526};
533527```
0 commit comments