import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; import { MatDialogRef , MatDialog , MatDialogConfig } from '@angular/material/dialog' ; import { AppConfirmComponent } from './app-confirm.component' ; @ Injectable ( ) export class AppConfirmService { constructor ( private dialog ) { } public confirm ( title , message ) { let dialogRef ; dialogRef = this . dialog . open ( AppConfirmComponent , { width : '380px' , disableClose : true , data : { title , message } , } ) ; return dialogRef . afterClosed ( ) as Observable < boolean > ; } }