AngularJS ng-clickDirective

AngularJS 参考手册AngularJS Reference Manual


AngularJS Example

Each time the button is clicked, the count variable automatically increments by 1:

<button ng-click="count = count + 1" ng-init="count=0">OK</button>

Try it Yourself »

Definition and Usage

ng-clickThe directive tells AngularJS what operation to perform after an HTML element is clicked.


Syntax

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

Supported by all HTML elements.


Parameter Values

Value Description
expression The expression to execute after the element is clicked.

AngularJS 参考手册AngularJS Reference Manual

Other Extensions