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
 |  Show 3 more ments

1 Answer 1

Reset to default 12

Use action="?" ... Angular is checking !attr.action, which if action == "", is true.

本文标签: