A lightweight easy to use module to display alert notifications inside you Angular web applications.
A lightweight easy to use module to display alert notifications inside you Angular web applications.
Github Code Link : https://github.com/harsh04/alert-notification
Sample implementation with controls : GitHub Pages.
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 { }
Add following tag on the root html such as app.component.html.
Import following service in your component:
`
import { AlertService } from 'alert-notification';
constructor(private alert: AlertService) { }
`
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$3
#### 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`