alert-notification
Version:
A lightweight easy to use module to display alert notifications inside you Angular web applications.
95 lines (71 loc) • 1.86 kB
Markdown
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](https://harsh04.github.io/alert-notification).
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 `<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) { }
```
```
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
```
this.alert.setPosition('top-left');
```
Default position : `'bottom-right'`
Avalilabe options:
1. `'top-left'`
2. `'bottom-left'`
3. `'top-right'`
4. `'bottom-right'`
```
this.alert.setInterval(5000);
```
Default Interval : `5000` (in ms)
```
this.alert.setAutoDismiss(true);
```
Default value : `true`
- if you want disable auto dismiss, set it to false.