In AngularJS, is there any way to make an ng-click dependent upon a boolean?
For example, I'd like the following text ("Click") to be clickable, but only when some scope property (e.g., $rootScope.enableClick) is true.
<div ng-click="count = count + 1" ng-init="count=0">Click</div>
Preferably, is there a straightforward way to do this without creating a custom directive?
+1with scope var+incrementdiva class name according to the booleanenableClickand the style the div with the help of that class name in a way thatpointer-events: none;. So it will be disabled.