import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class ModalWarningService { private subject = new Subject(); public modalRef = null; public config = { title: '', body: '' }; constructor() {} openModal(config: any): void { this.config = config; this.subject.next(); } getSubject(): Observable { return this.subject.asObservable(); } }