WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-submit Directive


Example

Run a capacity when the structure 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 application = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
    $scope.myTxt = "You have not yet clicked submit";
    $scope.myFunc = work () {
        $scope.myTxt = "You clicked submit!";
    }
});
</script>
</body>
Try it yourself »

Definition and Usage

The ng-submit mandate indicates a capacity to run when the structure is submitted.

If the structure does not have a action ng-submit will keep the structure from being submitted.


Syntax

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

Supported by the <form> element.


Parameter Values

Value Description
expression A capacity to be considered when the structure is being submitted, or an articulation to be assessed, which should restore a capacity call.