AngularJS ng-mousedown Instruction
AngularJS Examples
Execute an expression when the mouse is pressed:
<
div
ng-mousedown="count = count + 1"
ng-init=
"count=0"
Click me!
<
/div
<
h1
{{count}}
<
/h1Try it »
Definition and Usage
ng-mousedown The directive tells AngularJS the action to take when the mouse is pressed on the specified HTML element.
ng-mousedown The directive does not override the element's native onmousedown event. When the event is triggered,ng-mousedown both the expression and the native onmousedown event will be executed.
The order of mouse click events:
- Mousedown
- Mouseup
- Click
Syntax
<
element
ng-mousedown=
"expression"
<
/elementAll HTML elements support this directive.
Parameter value
| Value | Description |
|---|---|
| expression | The expression to execute when the mouse is clicked. |
AngularJS Reference Manual