-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Open
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: material/dialogfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fix
Description
Please describe the feature you would like to request.
Current behaviour: When a dialog is closed with esc or via backdrop click the provided result is undefined.
Desired behaviour: Allow to set a default result for these situations. I'd see several possible ways of doing this, for example:
- using the
MatDialogRefand a to be created method (e.g.setDefaultResult(...)) to be able to set this value comfortably from within the dialog. - using the MatDialogConfig to be able to set the value from the code opening the dialog
What is the use-case or motivation for this proposal?
We have some generic dialogs which also provide a "cancel" button that returns specific data. Currently everywhere the dialog is opened, we need to make a check whether the result is undefined or not. Providing a default value for those cases would definitely be better.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: material/dialogfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fix