AngularJS ng-submit directive
AngularJS instance
Execute the function after the form is submitted:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body ng-app="myApp" ng-controller="myCtrl"><form ng-submit="myFunc()"> <input type="text"> <input type="submit"></form><p>{{myTxt}}</p><p>The following example demonstrates AngularJS execution line after a form is submitted. </p><script>var app = angular.module("myApp", []);app.controller("myCtrl", function($scope) { $scope.myTxt = "You haven't clicked to submit!"; $scope.myFunc = function () { $scope.myTxt = "You clicked to submit!"; }});</script></body></html>Definition and usage
The ng-submit directive is used to execute a specified function after a form is submitted.
grammar
<form ng-submit="expression"></form>
The <form> element supports this property.
Parameter value
| value | describe |
|---|---|
| Expression | After the form is submitted, the function will be called, or an expression will be executed, and the expression will return to the function call. |
The above is the basic information sorting out the AngularJS jg-submit instruction. We will continue to add it later. Friends who need to study can read it.