blob: a922dc176cf88b6d91ae631613d5a2400e51d275 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
import { CommonModule } from "@angular/common";
import { NotificationSettings } from "../utilities/notification.config";
import { NotificationsService } from "../services/notifications.service";
import template from "./notifcontainer.component.html";
@Component({
selector: "sdc-notification-container",
template: template
})
export class NotificationContainerComponent implements OnInit {
notifications: NotificationSettings[] = [];
constructor(private notify: NotificationsService) {
}
public ngOnInit(){
this.notify.subscribe( (notif : NotificationSettings) => {
this.notifications.push(notif);
});
}
private onDestroyed = (event : any):void =>{
let index: number = this.notifications.indexOf(event);
if (index !== -1) {
this.notifications.splice(index, 1);
}
}
}
|