Fixed webapp build and error message.
[src/xds/xds-agent.git] / webapp / src / app / app-alert / app-alert.component.ts
1 import { Component, ViewEncapsulation } from '@angular/core';
2 import { Observable } from 'rxjs/Observable';
3
4 import { AlertService, IAlert } from '../services/alert.service';
5
6 @Component({
7     selector: 'app-alert',
8     template: `
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>
14       </alert>
15   </div>
16 `,
17 })
18
19 export class AppAlertComponent {
20
21     alerts$: Observable<IAlert[]>;
22
23     constructor(private alertSvr: AlertService) {
24         this.alerts$ = this.alertSvr.alerts;
25     }
26
27     onClose(al) {
28         this.alertSvr.del(al);
29     }
30
31 }