NGX-ALERTS is a simple and clean alert notification component of Angular 4+.
angular alert, angular alert popup, custom alert in angular, angular alert popup example, angular alert message on click, alert in typescript angular, angular notification component
How to make use of it:
Installation:
$ npm install ngx-alerts --save
1. Then from Appmdule angular:
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; // Import BrowserAnimationsModule import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; // Import your library import { AlertModule } from 'ngx-alerts'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserAnimationsModule, BrowserModule, // Specify your library as an import AlertModule.forRoot({maxMessages: 5, timeout: 5000, position: 'right'}) ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
2. Once your library is imported, you can use its components and serve it in your angular application:
<!-- You can now use your library component in app.component.html --> <h1> {{title}} </h1> <ngx-alerts></ngx-alerts>
@Component({ ... }) export class AppComponent { constructor(private alertService: AlertService) {} showAlerts(): void{ this.alertService.info('this is an info alert'); this.alertService.danger('this is a danger alert'); this.alertService.success('this is a success alert'); this.alertService.warning('this is a warning alert'); } }
alert service for angular, ngx-alerts Plugin/Github
See Demo And Download
Official Website(MathijsBlok): Click Here
This superior jQuery/javascript plugin is developed by MathijsBlok. For extra advanced usage, please go to the official website.