-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Closing MdDialog with md-dialog-close on button refreshes page #2599
Comments
It's because the button ends up submitting the form by default. You should be able to work around it by setting |
That fixed it. The odd part is that it only occurred on that dialog when its form had pre-populated data. The other dialogs I have with forms dont do that. |
I think it would be reasonable to have the dialog-close-button always set |
@crisbeto @jelbourn This does not work! Remember, that you can close form also with pushing enter button, and that would fire submit event (and thus cause reload) even if you've specified the button to be type="button" (learned it the hard way). The only way is to do something like this:
Thats not really a bug with material, more like inconvenience within angular. |
Pressing enter will only submit the form if there is a submit button inside of the form. |
Prevents the `md-dialog-close` directive from submitting any forms that it is inside of. Fixes angular#2599.
Prevents the `md-dialog-close` directive from submitting any forms that it is inside of. Fixes #2599.
…2659) Prevents the `md-dialog-close` directive from submitting any forms that it is inside of. Fixes angular#2599.
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. |
Bug, feature request, or proposal:
Bug
What is the expected behavior?
I prepopulate a form inside of an MdDialog with data. I can click on a cancel button to close the dialog. That button is:
The dialog then closes with no issues.
What is the current behavior?
When I click on the close button it refreshes the page with a query string containing the serialized data of the form.
What are the steps to reproduce?
Dialog component html:
typescript:
angular-cli: 1.0.0-beta.24
node: 6.9.3
os: darwin x64
@angular/common: 2.4.2
@angular/compiler: 2.4.2
@angular/core: 2.4.2
@angular/forms: 2.4.2
@angular/http: 2.4.2
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.2
@angular/platform-browser-dynamic: 2.4.2
@angular/router: 3.4.2
@angular/compiler-cli: 2.4.2
The text was updated successfully, but these errors were encountered: