bootstrap-toast
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

BootstrapToast for Angular 2+

Simple toast library for Angular 2+ with Bootstrap 4. See this demo and try options.

Requirements

Must be install the following npm packages:

  1. bootstrap

Installation

npm install --save bootstrap-toast

Import bootstrap-toast module your ngModule. Paste the following code the end of the app.component.html file:

<lib-bootstrap-toast [config]="config"></lib-bootstrap-toast>

The config parameter is optional but if you want to modify default config, you use the following format:

{
  "position": "top-right", // or top-left, bottom-left, bottom-right
  "autoclose": true, // true or false
  "delay": 3 // seconds
}

The following example shows how to create a toast notification programatically. The function returns Subject instance. If the notification has one or more buttons, you can subscribe this instance to catch button actions.

this.toast.create( {
  "title": "Message",
  "message": "This is Sparta!",
  "buttons": [
    {
      "label": "OK",
      "action": "ok",
      "class": "btn-primary"
    },
    {
      "label": "Cancel",
      "action": "cancel",
      "class": "btn-light"
    }
  ]
} ).subscribe(action => { ... })

Thats all.

Readme

Keywords

Package Sidebar

Install

npm i bootstrap-toast

Weekly Downloads

4

Version

1.0.13

License

none

Unpacked Size

283 kB

Total Files

53

Last publish

Collaborators

  • godanydev