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: A

  • Element: ANY

  • Priority: 0

  • Description: Expression to evaluate upon click event. PointerEvent object is available as $event.

  • Example:

    <div ng-click="$ctrl.greet($event)"></div>
    

Demo

<section ng-app>
  <button class="btn btn-dark" ng-init="count = 0" ng-click="count = count + 1">
    Increment
  </button>
  <span> count: {{count}} </span>
</section>
count: {{count}}