import { Injectable, EventEmitter } from '@angular/core'; import { Notification } from '../_models/notification.class'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; @Injectable({ providedIn: 'root' }) export class NotificationService { private subject = new Subject(); constructor() { } notify(type: string, content?: string, icon?: string) { this.subject.next({ type, content, icon }); } getMessage(): Observable { return this.subject.asObservable(); } }