To install this library, run:
$ npm install angular4-notify --save
Import notifications module and service:
import {NotificationsModule, NotificationsService} from 'angular4-notify';
@NgModule({
declarations: [
YouComponent
],
imports: [
SomeModule,
//add to imports
NotificationsModule
],
providers: [
//add to providers
NotificationsService
],
bootstrap: [YouComponent]
})
export class YourModule {}
Once library is imported, you can use its service in your Angular application:
<!-- You can now use your library component in app.component.html -->
<header></header>
<angular4-notify-notifications-container></angular4-notify-notifications-container>
<router-outlet></router-outlet>
To add notifications to be rendered firstly inject NotificationsService into your component:
import {NotificationsService} from 'angular4-notify';
constructor(protected notificationsService: NotificationsService) {}
and then use following methods:
this.notificationsService.addError('Error message here');
this.notificationsService.addWarning('Some warning message');
this.notificationsService.addInfo('Information message');
1.2.0 Clear notifications after navigation start.
1.1.0 Prevent from similar messages doubling.
1.0.1 First stable version
##TODO
- allow customize styles
- provide more flexible notifications` container position on page
- implement "dialog" notification feature
MIT © alexander.poltoratskiy