2 * Copyright (c) 2017 ZTE Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and the Apache License 2.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * ZTE - initial API and implementation and/or initial documentation
13 import { Component, OnInit } from '@angular/core';
15 import { Notice } from '../../model/notice';
16 import { NoticeType } from '../../model/notice-type.enum';
17 import { NoticeService } from '../../services/notice.service';
20 selector: 'wfm-notice',
21 templateUrl: './global-notice.component.html',
22 styleUrls: ['./global-notice.component.css']
24 export class GlobalNoticeComponent implements OnInit {
25 public notices: Notice[] = [];
26 public noticeType = NoticeType;
28 constructor(private noticeService: NoticeService) { }
31 // const t = new Notice(NoticeType.success, 'success');
32 // const t1 = new Notice(NoticeType.info, 'info');
33 // const t2 = new Notice(NoticeType.warning, 'warning');
34 // const t3 = new Notice(NoticeType.danger, 'danger');
35 // this.notices.push(t);
36 // this.notices.push(t1);
37 // this.notices.push(t2);
38 // this.notices.push(t3);
39 this.noticeService.showNotice$.subscribe(notice => {
40 this.notices.push(notice);
44 public onClosed(index: number): void {
45 this.notices.splice(index, 1);