ngx-flash-messages
Flash messages for Angular 2+ Demo
Usage
Add the library to your dependencies
npm install --save ngx-flash-messages
Import the FlashMessagesModule
into your main module
// app.module.ts ; // ...
To display a new flash message we need to make use of the FlashMessagesService
by importing it, adding it into the component's (or service) dependency injection and using the show()
method
// my-component.component.ts; ;
Then you just need to decide where to render your messages (Typically at the top of your page)
<!-- app.component.html --> <!-- This is where your flash messages will be displayed --> <!-- ... Your code ... -->
The library is css independant, so you're free of using whichever css framework or library of your choosing, or your own css, the Demo and the usage guide both use bootstrap classes just as a sample.
License
The repository code is open-sourced software licensed under the MIT license.