// popover.service.ts import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class PopoverService { private showPopoverSource = new Subject<{ title: string; message: string; showInput: boolean; showCancel: boolean; inputValue: string; confirmText: string; onConfirm: () => void; onCancel?: () => void; }>(); popoverState$ = this.showPopoverSource.asObservable(); show(options: { title: string; message: string; confirmText?: string; showCancel?: boolean; onConfirm?: (inputValue?: string) => void; onCancel?: () => void }) { this.showPopoverSource.next({ showInput: false, inputValue: null, confirmText: 'Ok', showCancel: false, onConfirm: (inputValue?: string) => {}, ...options, }); } showWithInput(options: { title: string; message: string; confirmText: string; inputValue: string; onConfirm: (inputValue?: string) => void; onCancel?: () => void }) { this.showPopoverSource.next({ showInput: true, showCancel: true, ...options, }); } }