Tutorial 21 - event ng-click in angularjs?

How to use ng-click in angularjs?

This sample will help you know about using ng-click in AngularJS



 <html>  
   <head>  
     <title>Angular JS Model</title>  
     <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>  
     <script>  
       angular.module('MyForm', [])  
           .controller('myController', ['$scope', function($scope) {  
     $scope.count = 0;  
 $scope.Addone = function () {  
         $scope.count++;  
       };  
            }]);  
     </script>  
   </head>  
   <body ng-app="MyForm">  
           <h1>How to use ng-click</h1>  
           <input type="button" value="Click Me" ng-click="Addone()" /> <br /><br />  
     <span>You click {{count}} times</span>  
   </body>  
  </html>  


No comments:

Post a Comment

Popular Posts