AngularJS ng-submit Instruction
AngularJS Examples
Execute a function after the form is submitted:
<
body
ng-app=
"myApp"
ng-controller=
"myCtrl"
<
form
ng-submit=
"myFunc()"
<
input
type=
"text"
<
input
type=
"submit"
<
/form
<
p
{{myTxt}}
<
/p
<
script
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.myTxt = "You have not clicked submit yet!";
$scope.myFunc = function () {
$scope.myTxt = "You clicked submit!";
}
});
<
/script
<
/body
Try it »
Definition and Usage
ng-submit The directive is used to execute a specified function after the form is submitted.
Syntax
<
form
ng-submit=
"expression"
<
/form
AngularJS Reference Manual