डाउनलोड पी.डी.एफ. ई-बुक्स
AJS - Directives ng-submit

ng-submit directive ये जब form submit किया जाता है तब दिया हुआ expression execute होता है |


Syntax for ng-submit Directive in AngularJS

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

ng-submit Attribute's Parameters in AngularJS

expression : यहाँ पर expression दिया जाता है | expression पर function call किया जाता है |


Example for ng-submit Directive using String in AngularJS

Source Code :
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body>

<div ng-app="app" ng-controller="ctrl">

<form ng-submit="myFunction()">  
<input type="text">  
<button type="submit">Submit</button>
</form>  

<p>{{message}}</p>
  
<script>  
var myapp = angular.module("app", []);  
myapp.controller("ctrl", function($scope){  
$scope.myFunction = function () {  
	$scope.message = "Button Clicked.";  
}  
});  
</script>  

</div>

</body>
</html>
Output :

{{message}}