AngularJS ng-submit
Directive
AngularJS Reference Manual
AngularJS Example
Execute a function after form submission:
<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 haven't clicked submit yet!";
$scope.myFunc = function () {
$scope.myTxt = "You clicked submit!";
}
});
</script>
</body>
Definition and Usage
The ng-submit directive is used to execute a specified function after the form is submitted.
Syntax
The <form> element supports this attribute.
Parameter Values
Value |
Description |
expression |
A function will be called after form submission, or an expression will be executed, which returns a function call. |
AngularJS Reference Manual