alert-notification
v1.3.0
Published
A lightweight easy to use module to display alert notifications inside you Angular web applications.
Downloads
70
Maintainers
Readme
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 :
- ID
- Type
- Info
- Success
- Warning
- Empty string ''
- Title
- Message
Configure Alerts
Position
this.alert.setPosition('top-left');
Default position : 'bottom-right'
Avalilabe options:
'top-left'
'bottom-left'
'top-right'
'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.