Press "Enter" to skip to content

Ngx Snackbar Toast Notifications For Angular

Angular 7 Notifications Snackbar (AKA Toast) component can be used to display notification information for a short period of time.

angular material toast vs snackbar, angular material notification, custom snackbar angular, angularmaterial snackbar position, angular snackbar example

Angular ngx Bootstrap Alerts As Notifications Plugin

How to make use of it:

Installation

npm install --save ngx-snackbar

Usage

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {AppComponent} from './app.component';
import {SnackbarModule} from 'ngx-snackbar';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    SnackbarModule.forRoot()
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
<ngx-snackbar></ngx-snackbar>

Options

Use these properties to customize the snackbar component.

NameDescriptionTypeDefaultOptional
positionThe position where the snackbar appearstop-lefttop-centertop-rightbottom-leftbottom-centerbottom-rightbottom-righttrue
maxThe maximum number of snackbars allowed on screennumber(Infinite)true
timeoutNumber of milliseconds before the snackbar closesnumber(Infinite)true
colorText color in hexstringautotrue
backgroundBackground color in hexstring#343434true
customClassCustom class to append to the snackbarstring true
accentAction button color. Requires action.textstring#2196f3true

Events

NameDescriptionReturn
onAddCallback gets triggered on snackbar addObject
onRemoveCallback gets triggered on snackbar removeObject
onClearCallback gets triggered on snackbar clearboolean

Snackbar angular Notification Component, ngx-snackbar Plugin/Github


See Demo And Download

Official Website(dank): Click Here

This superior jQuery/javascript plugin is developed by dank. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.