angular4-notify
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

angular4-notify

Installation

To install this library, run:

$ npm install angular4-notify --save

How to use

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 your 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>

Adding notifications

To add notifications to be rendered firstly inject NotificationsService into your component:

import {NotificationsService} from 'angular4-notify';
 
constructor(protected notificationsServiceNotificationsService) {}

and then use following methods:

this.notificationsService.addError('Error message here');
this.notificationsService.addWarning('Some warning message');
this.notificationsService.addInfo('Information message');

Changelist

1.2.0 resetting notifications array while navigating with router.

1.1.0 Prevent from similar messages doubling.

1.0.1 First stable version

License

MIT © alexander.poltoratskiy

Readme

Keywords

Package Sidebar

Install

npm i angular4-notify

Weekly Downloads

10

Version

1.2.0

License

MIT

Last publish

Collaborators

  • myownsumm