You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Do not preventDefault on form submit if action="" #5962
Submitting a form and preventing the default action
[...]
For this reason, Angular prevents the default action (form submission to the server) unless the <form> element has an action attribute specified.
Yet, if you specify <form action="">...</form>, angularjs consider that no action attribute is specified, which is not true.
The test condition in src/ng/directive/form.js is not strict enough (in the form directive)
if (!attr.action) {
I'm no JS expert, but I think a stricter comparison would be more appropriate (such as the following)
A lot of us are mixing Angular into our traditional site frameworks rather than full SPAs, so the fact that all form tags get auto-directive'd causes a lot of unexpected issues like these.
An even better fix (I think) would be removing ngForm's form alias (or allowing us to via module configuration) and making all forms opt-in via ng-form='' attributes, although I imagine it's too much of a breaking-change for a minor update.
Maybe a <form ng-form-ignore='' >... that prevents the controller from binding/initializing at all?
ngForm still has some growing up to do (ex. validation on dynamically named inputs) and it's a real bummer when it interferes with our non-angular functionality.
Activity
xel1045 commentedon Jan 23, 2014
This might be a better idea than getting people to do the following (http://stackoverflow.com/questions/14711334/in-angularjs-is-there-a-way-to-disable-the-prevention-of-default-action-when-a/14711504#14711504).
mhov commentedon Mar 7, 2014
A lot of us are mixing Angular into our traditional site frameworks rather than full SPAs, so the fact that all form tags get auto-directive'd causes a lot of unexpected issues like these.
An even better fix (I think) would be removing ngForm's
formalias (or allowing us to via module configuration) and making all forms opt-in viang-form=''attributes, although I imagine it's too much of a breaking-change for a minor update.Maybe a
<form ng-form-ignore='' >...that prevents the controller from binding/initializing at all?ngForm still has some growing up to do (ex. validation on dynamically named inputs) and it's a real bummer when it interferes with our non-angular functionality.
Narretz commentedon Jun 25, 2014
This is a duplicate of #3370, with a pr in #3776