admin管理员组文章数量:1289527
In my code, I have a form that looks like this:
<form action="" method="post">
By default, AngularJS disables form submissions without an action attribute specified. I understand I can (and should) assign a form action, however I'd like to know if there's a simple way to prevent AngularJS from intercepting this specific form submission event so that it can post normally.
In my code, I have a form that looks like this:
<form action="" method="post">
By default, AngularJS disables form submissions without an action attribute specified. I understand I can (and should) assign a form action, however I'd like to know if there's a simple way to prevent AngularJS from intercepting this specific form submission event so that it can post normally.
Share Improve this question asked Feb 5, 2013 at 15:46 Mike RobinsonMike Robinson 25.2k8 gold badges63 silver badges83 bronze badges 8-
1
Post to where?
action=""
is the same as no action at all. – Ben Lesh Commented Feb 5, 2013 at 15:47 - 1 action="" will post to the current page – Mike Robinson Commented Feb 5, 2013 at 15:49
- I'm still confused, what are you trying to do? – Ben Lesh Commented Feb 5, 2013 at 16:01
- I think you're trying to get forms with action="" to behave like other forms in angular? If so, I have an answer, if not, disregard. – Ben Lesh Commented Feb 5, 2013 at 16:06
- I'm trying to get the form to post back to itself. If the form is on a page with the URL of "/users", it normally posts back to "/users". However, AngularJS prevents that from happening (see documentation). I want to tell AngularJS that it actually should act like a normal form, and post back to itself. – Mike Robinson Commented Feb 5, 2013 at 16:08
1 Answer
Reset to default 12Use action="?"
... Angular is checking !attr.action
, which if action == "", is true.
本文标签:
版权声明:本文标题:javascript - In AngularJS, is there a way to disable the prevention of default action when a form is missing the action attribut 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741405745a2376934.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论