VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-submit-directive/

⇱ AngularJS ng-submit Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-submit Directive

Last Updated : 11 Jul, 2025

The ng-submit Directive in AngularJS is used to specify the functions to be run on submit events. It can be used to prevent the form from submission if it does not contain an action. It is supported by <form> element

Syntax:

<form ng-submit="expression"> 
 Content ... 
</form>

Parameter:

  • expression: When submitting the form, then the function will be invoked to evaluate an expression that will return the function call.

Example 1: This example describes the basic use of the ng-submit Directive in AngularJS.

Output:

👁 Image
 

Example 2: This example describes the ng-submit Directive in AngularJS, where the greeting message will be displayed once the user is logged in.

Output:

👁 Image
 
Comment

Explore