Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorial</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> </head> <body ng-app="myApp" ng-controller="submitCtrl"> <h3>ng-submit directive in AngularJS Tutorial</h3> <form ng-submit="myFunc()"> Enter text:<input type="text"><br><br> <input type="submit"> <h2>Text submitted {{count}} times successfully</h2> </form> <script> var app = angular.module("myApp", []); app.controller("submitCtrl", function($scope) { $scope.count=0; $scope.myFunc = function () { $scope.count = $scope.count + 1; } }); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.