Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

AngularJS ng-click Directive

AngularJS ng-click Instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS Examples

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

<

button

ng-click=

"count = count + 1"

ng-init=

"count=0"

OK

<

/button

Try it »


Definition and Usage

ng-click The directive tells AngularJS the action to take when the HTML element is clicked.


Syntax

<

element

ng-click=

"expression"

<

/element

All HTML elements are supported.


Parameter value

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

AngularJS Reference Manual AngularJS Reference Manual