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

AngularJS ng-mousedown Directive

AngularJS ng-mousedown Instruction

AngularJS Reference Manual AngularJS Reference Manual


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}}

<

/h1

Try 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:

  1. Mousedown
  2. Mouseup
  3. Click

Syntax

<

element

ng-mousedown=

"expression"

<

/element

All HTML elements support this directive.


Parameter value

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

AngularJS Reference Manual AngularJS Reference Manual