1 import { Component } from '@angular/core';
2 import { Observable } from 'rxjs';
4 import {AlertService, IAlert} from '../common/alert.service';
9 <div style="width:80%; margin-left:auto; margin-right:auto;" *ngFor="let alert of (alerts$ | async)">
10 <alert *ngIf="alert.show" [type]="alert.type" [dismissible]="alert.dismissible" [dismissOnTimeout]="alert.dismissTimeout"
11 (onClose)="onClose(alert)">
12 <span [innerHtml]="alert.msg"></span>
18 export class AlertComponent {
20 alerts$: Observable<IAlert[]>;
22 constructor(private alertSvr: AlertService) {
23 this.alerts$ = this.alertSvr.alerts;
27 this.alertSvr.del(al);