$ npm install --global vox-alert
$ npm install --save-dev vox-alert
Import VoxAlertModule into your app.module.
import { VoxAlertModule } from 'vox-alert';
@NgModule({
...
imports: [
VoxAlertModule
],
})
Import AlertService into your app.component
import { Component } from '@angular/core';
import { AlertService } from 'vox-alert/alert/alert-service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public title = 'app';
private _alertService: AlertService;
constructor(
alertService: AlertService
) {
this._alertService = alertService;
}
open() {
this._alertService.openalert('AlertServiceService', 'alert title', 'success');
}
}
Place the app-alert selector at the bottom of your app.component.html
<button type="button" class="btn btn-info" (click)="open()">Create template alert</button>
<app-alert></app-alert>
The following message types are avialable. The typess below represent the Bootstrap alert classes.
- success
- info
- warning
- danger