AngularJS ng-mousedown directive
Definition and Usage
ng-mousedown
The instruction tells AngularJS what operation to perform when the mouse button is clicked on a specific HTML element.
AngularJS's ng-mousedown
Directives do not override the original onmousedown event of the element, both will be executed.
The order of mouse clicks is:
- Mousedown (mouse press)
- Mouseup (mouse release)
- Click (click)
Example
Execute expressions when the mouse clicks:
<div ng-mousedown="count = count + 1" ng-init="count=0">Click me!</div> <h1>{{count}}</h1>
Syntax
<element ng-mousedown="expression</element>
All HTML elements support.
Parameters
Parameters | Description |
---|---|
expression | An expression to be executed when the mouse button is clicked. |