-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Add a beforeClose method for MdDialog #4647
Comments
Related #3460 |
We did originally plan on adding a |
Well, I guess something like that could work too. Do you expect to have this functionally any time soon? |
In my opinion |
To pitch in here (from over in #5209), I'd also like to have the value of the user choice exposed in an observable before/on close, to get access to it without having to wait for the animation. |
Much needed! We have a use-case where we want to save data if the user cancels the dialog (via clicking on backdrop or hitting the Esc key). Where the problem comes in, is if there's a server error, we want to keep the modal up still to display the message. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Feature Request
What is the expected behavior?
When the user is about to close a MdDialog window (via Esc key, clickout or close button), for example an edit dialog, it would be nice to be able to have some method to prevent the window from closing to avoid unsaved changes for example.
What is the use-case or motivation for changing an existing behavior?
Since the MdDialog already listens to Esc key events, clickout and has the close() method that is used in the action buttons, it would be much easier to have a method like afterClosed that is called just before the closing event is going to occur, so we could prevent it from happening just returning
true
orfalse
in a callback function. This way we don't have to overwrite those event listeners.The text was updated successfully, but these errors were encountered: