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.confirm
on the following things :According to referrence link shared in comments,
i have implemented a Stackblitz Demo, which uses
@HostListener
Code for
esc
, andrefresh
:And in
ConfirmationDialog
component, handlebackDropClick()
asApplication Code : https://stackblitz.com/edit/dialog-example-beforeclose?file=app%2Fapp.component.ts