1 import { Component, ViewEncapsulation } from '@angular/core';
2 import { Observable } from 'rxjs/Observable';
4 import { AlertService, IAlert } from '../services/alert.service';
9 <div style="width:80%; margin-left:auto; margin-right:auto;"
10 *ngFor="let alert of (alerts$ | async)">
11 <alert *ngIf="alert.show" [type]="alert.type" [dismissible]="alert.dismissible" [dismissOnTimeout]="alert.dismissTimeout"
12 (onClose)="onClose(alert)">
13 <div style="text-align:center;" [innerHtml]="alert.msg"></div>
19 export class AppAlertComponent {
21 alerts$: Observable<IAlert[]>;
23 constructor(private alertSvr: AlertService) {
24 this.alerts$ = this.alertSvr.alerts;
28 this.alertSvr.del(al);