ngx-simple-toaster
v0.1.0
Published
Simple Angular toaster module with clean modern UI
Downloads
4
Readme
NGX Simple Toaster
A lightweight and simple toaster to show notifications in your app!
Install
- Install the package
npm install ngx-simple-toaster --save
- Add the toaster wrapper to app.component.html
<ngx-simple-toaster></ngx-simple-toaster>
Usage
- In any component add the NgxSimpleToaster service to the constructor
constructor(private toasterService: NgxSimpleToasterService) { }
- Call and pass the data to show
this.toasterService.show({type: 'success', message: 'Hoorayy!'});
Options
Toast model
In order to show toaster, you need to pass and object with data.
Interface of the toast NgxToasterModel
.
| Option | Type | Default | Optional | | ------ | ---- | ------- | ---------| | type | NgxToasterType | undefined | false | | message | string | undefined | false | | title | string | undefined | true | | delay | number | 6000 | true | | time | string | undefined | true | | customActionLabel | string | "Close" | true|
Types of the toasts NgxToasterType
:
| Option | Type | | ------ | ---- | | 'info' | string | | 'error' | string | | 'success' | string | | 'warning' | string |
On action click callback
In the method .show
, the second param takes a callback, which will be invoked when the user clicks
on the action button (by default it has "Close" label).