AngularJS ng-mousedown directive
AngularJS instance
Execute the expression when the mouse is pressed:
<!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=""><div ng-mousedown="count = count + 1" ng-init="count=0">Click me!</div><h1>{{count}}</h1><p>This example demonstrates that when the mouse is pressed on the DIV element, the calculated variable "count" will automatically add 1. </p></body></html>Definition and usage
The ng-mousedown directive tells the AngularJS mouse to perform when pressing on the specified HTML element.
The ng-mousedown directive will not overwrite the element's native onmousedown event. When the event is triggered, both the ng-mousedown expression and the native onmousedown event will be executed.
The order of mouse click execution:
1.Mousedown
2.Mouseup
3.Click
grammar
<element ng-mousedown="expression"></element>
All HTML elements support this directive.
Parameter value
| value | describe |
|---|---|
| Expression | The expression executed when the mouse clicks. |
The above is a compilation of the basic information of AngularJS ng-mousedown, and will be supplemented later!