0.1.0 • Published 4 years ago

ngx-simple-toaster v0.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

NGX Simple Toaster

A lightweight and simple toaster to show notifications in your app!

Install

  1. Install the package npm install ngx-simple-toaster --save
  2. Add the toaster wrapper to app.component.html <ngx-simple-toaster></ngx-simple-toaster>

Usage

  1. In any component add the NgxSimpleToaster service to the constructor constructor(private toasterService: NgxSimpleToasterService) { }
  2. 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.

OptionTypeDefaultOptional
typeNgxToasterTypeundefinedfalse
messagestringundefinedfalse
titlestringundefinedtrue
delaynumber6000true
timestringundefinedtrue
customActionLabelstring"Close"true

Types of the toasts NgxToasterType:

OptionType
'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).

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago