AngularJS Events

The ng-click directive defines an AngularJS click event.

Sample Code:

<!DOCTYPE html>
<html>
<script src= “http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js”></script>
<body>
<div ng-app = “” ng-init = “count = 0”>
<button ng-click = “count = count + 1”>Incrment</button>
<p>{{ count }}</p>
</div>
</body>
</html>

Output:

After clicking the Increment button once

Cheers!!!

Leave a Reply