ng-click
Handler for click event
Description
The ng-click directive allows you to specify custom behavior when an element
is clicked.
Parameters
ng-click
Type: Expression
Restrict:
AElement: ANY
Priority:
0Description: Expression to evaluate upon click event. PointerEvent object is available as
$event.Example:
<div ng-click="$ctrl.greet($event)"></div>Event policy attributes can be added to the same element:
<button ng-click="$ctrl.submit($event)" data-event-prevent data-event-once> Submit </button>data-event-prevent,data-event-stop,data-event-capture,data-event-once, anddata-event-passiveapply to every event directive on the same element.
Demo
<section ng-app>
<button class="btn btn-dark" ng-init="count = 0" ng-click="count++">
Increment
</button>
<span> count: {{count}} </span>
</section>
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.