Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(MatDialog): Accept a function on MatDialogRef's disableClose #25867

Open
robmv opened this issue Oct 26, 2022 · 0 comments
Open

feat(MatDialog): Accept a function on MatDialogRef's disableClose #25867

robmv opened this issue Oct 26, 2022 · 0 comments
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

Comments

@robmv
Copy link

robmv commented Oct 26, 2022

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.

@robmv robmv added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Oct 26, 2022
@andrewseguin andrewseguin added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/dialog and removed needs triage This issue needs to be triaged by the team labels May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants