AngularJS ng-click directive
AngularJS instance
Each time the button is clicked, the count variable count will automatically add 1:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body ng-app=""><p>Click the button:</p><button ng-click="count = count + 1" ng-init="count=0">OK</button><p>The button was clicked {{count}} times. </p><p>In the example, the variable "count" of the button will be automatically added to 1 every time it is clicked. </p></body></html>Note: In the example, the variable "count" is clicked every time the button is clicked.
Definition and usage
The ng-click directive tells the AngularJS HTML element that needs to be performed after it is clicked.
grammar
<element ng-click="expression"></element>
All HTML elements are supported.
Parameter value
| value | describe |
|---|---|
| Expression | An expression executed after the element is clicked. |
The above is a compilation of the AngularJS ng-click instruction information. We will continue to add it later. I hope that friends who can help program AngularJS.