Open
Description
Feature Description
Currently MatDialogRef's disableClose type is boolean | undefined
. Allow another function type like () => boolean
in order to have dynamic checks before processing the ESC key or clicking outside the dialog.
Use Case
The most use I have of disableClose
is to disable it when a form is dirty. As there is no event yet on Angular for the dirty state, I have to resort to:
ngDoCheck(): void {
// WORKAROUND Remove when there are proper events for dirty status changes
this.dialogRef.disableClose = this.form.dirty;
}
It would help a lot if disableClose
could be function that can check, in my case, the form dirty state and that way remove the DoCheck
lifecycle event.