English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> </head> <body ng-app=""> <div ng-mouseup="count = count + 1" ng-init="count=0">Click me!</div> <h1>{{count}}</h1> <p> Execute the expression when the mouse button is released on the element: In this example, when the mouse is pressed and released on the DIV element, the variable "count" will automatically increase 1。</p> </body> </html>Test and see ‹/›
ng-mouseup The directive is used to tell AngularJS what operation to perform when the mouse button is released (clicked) on the specified HTML element.
ng-mouseup The directive does not override the native onmouseup event of the element, when the event is triggered,ng-mouseup Both the expression and the native onmouseup event will be executed.
The order of mouse clicks:
Mousedown
Mouseup
Click
<element ng-mouseup="expression"></element>
All HTML elements support this directive.
Value | Description |
---|---|
expression | The expression to be executed when the mouse button is released after clicking. |