O'Reilly logo

Mastering Web Application Development with AngularJS by Pawel Kozlowski, Peter Bacon Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling traditional HTML form submission

In this section we take a look at how AngularJS handles submission of forms. Single Page AJAX Applications, for which AngularJS is perfect, don't tend to follow the same process of direct submission to the server as traditional web application do. But sometimes your application must support this. Here we show the various submission scenarios that you may wish to implement when submitting form data back to a server.

Submitting forms directly to the server

If you include an action attribute on a form in an AngularJS application, then the form will submit as normal to the URL defined in the action:

<form method="get" action="http://www.google.com/search">
  <input name="q">
</form>

Try it at http://bit.ly/115cQgq ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required