feat(MatDialog): Accept a function on MatDialogRef's disableClose #25867
Labels
area: material/dialog
feature
This issue represents a new feature or feature request rather than a bug or bug fix
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
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:It would help a lot if
disableClose
could be function that can check, in my case, the form dirty state and that way remove theDoCheck
lifecycle event.The text was updated successfully, but these errors were encountered: