Prev Demo
AngularJS
>
Ng-Click Event
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <script> var app = angular.module("app", []); app.controller("ClickController", function ($scope) { $scope.counter = 0; $scope.Increment = function () { $scope.counter += 2; } }); </script> <div ng-app="app" ng-controller="ClickController"> <button ng-click="Increment()">Increment</button> <p>Counter: {{ counter }}</p> <button ng-click="myCount = myCount + 1">Counter </button> Counter: {{ myCount }} </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output