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

ng-click directive ये जब User द्वारा click किया जाता है तब दिया हुआ expression execute होता है |


Syntax for ng-click Directive in AngularJS

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

ng-click Attribute's Parameters in AngularJS

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


Example for ng-click 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 = "">

<p ng-init="c = 0" ng-click="c = c + 1" />
Click Me.
</p>

<p>Clicked {{c}} times.</p> 

</div>

</body>
</html>
Output :

Click Me.

Clicked {{c}} times.