alert-notification
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

AlertNotification

A lightweight easy to use module to display alert notifications inside you Angular web applications.

Github Code Link : https://github.com/harsh04/alert-notification

Demo

Sample implementation with controls : GitHub Pages.

Install

You can import your library in any Angular application by running:

$ npm install alert-notification

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
 
import { AppComponent } from './app.component';
 
// Import your library
import { AlertModule } from 'alert-notification';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
 
    // Specify your library as an import
    AlertModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

How to use

Add following tag on the <alert-notification></alert-notification> root html such as app.component.html.

Import following service in your component:

import { AlertService } from 'alert-notification';

constructor(private alert: AlertService) { }

Create New Alert

this.alert.push('id-01', 'Info', 'New Request', 'You have received a new mail');

Parameters :

  1. ID
  2. Type
    • Info
    • Success
    • Warning
    • Empty string ''
  3. Title
  4. Message

Configure Alerts

Position

this.alert.setPosition('top-left');

Default position : 'bottom-right' Avalilabe options:

  1. 'top-left'
  2. 'bottom-left'
  3. 'top-right'
  4. 'bottom-right'

Dismiss Interval

this.alert.setInterval(5000);

Default Interval : 5000 (in ms)

Auto Dismiss alert

this.alert.setAutoDismiss(true);

Default value : true

  • if you want disable auto dismiss, set it to false.

Package Sidebar

Install

npm i alert-notification

Weekly Downloads

10

Version

1.3.0

License

MIT

Unpacked Size

107 kB

Total Files

26

Last publish

Collaborators

  • harsh04_