import {Injectable, TemplateRef} from '@angular/core'; import {BehaviorSubject} from 'rxjs'; @Injectable({ providedIn: 'root' }) export class ModalService { private modal = new BehaviorSubject | null>(null) constructor() {} showModal(template: TemplateRef) { console.log("got here", template) this.modal.next(template) } hideModal() { this.modal.next(null) } getModalBehaviorSubject() { return this.modal; } }