Angular2 Simple Notify
Intall
npm install --save angular2-simple-notify
don't forget to add systemjs config
//... map: //... 'angular2-simple-notify': 'node_modules/angular2-simple-notify' //...
Getting Started
boot.ts
or main.ts
// ...
import { ROUTER_PROVIDERS } from '@angular/router'
// ...
bootstrap(AppComponent, [ROUTER_PROVIDERS]);
app.component.ts
;//...;;
Use <notify></notify>
tag only once in your application.
You can add an instant notification with NotifyService.addNotify()
Guide
NotifyInterface
NotifyComponent
<notify
[position]="position"
[timeout]="timeout"
[type]="type">
</notify>
- position: string This is the position of the notification. Default value is
"top right"
. - timeout: number This is the life time of the notification. Default value is
3000
. - type: string This is the default type of the notification. Default value is
"success"
. Remember each notification has is own propertytype
.
NotifyService
- addNotify(notify: NotifyInterface): void: Add instant notification.
- addPendingNotify(notify: NotifyInterface): void: Add notification but will be displayed after route changes.
Extends
Extends the NotifyComponent to use your own template.
Here is the minimal code before overriding the template.
;;
Now you just need to call <my-notify></my-notify>