How can i use of beforeClose() method to show a confirmation message before closing the material dialog ?
this.dialogRef.beforeClose().subscribe(result => {
var cn = confirm('You have begun editing fields for this user.
Do you want to leave without finishing?')
console.log(cn);
})
As you want the
window.confirmon the following things :According to referrence link shared in comments,
i have implemented a Stackblitz Demo, which uses
@HostListenerCode for
esc, andrefresh:And in
ConfirmationDialogcomponent, handlebackDropClick()asApplication Code : https://stackblitz.com/edit/dialog-example-beforeclose?file=app%2Fapp.component.ts