Improve this Doc View Source ngSubmit

  1. directive in module ng

Enables binding angular expressions to onsubmit events.

Additionally it prevents the default action (which for form means sending the request to the server and reloading the current page), but only if the form does not contain action, data-action, or x-action attributes.

Warning: Be careful not to cause "double-submission" by using both the ngClick and ngSubmit handlers together. See the form directive documentation for a detailed discussion of when ngSubmit may be triggered.

Directive Info

  • This directive executes at priority level 0.

Usage

  • as element: (This directive can be used as custom element, but be aware of IE restrictions).
    <ng-submit
      ng-submit="expression">
    ...
    </ng-submit>
  • as attribute:
    <form
      ng-submit="expression">
    ...
    </form>

Arguments

Param Type Details
ngSubmit expression

Expression to eval. (Event object is available as $event)

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.5.11/docs/api/ng/directive/ngSubmit