AngularJS Basic ng mousemove Simple Example
- 2021-07-07 06:13:17
- OfStack
AngularJS ng-mousemove Directive
AngularJS instance
Executes an expression when the mouse pointer moves over an element:
<!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-mousemove="count = count + 1" ng-init="count=0"> Move the mouse around me !</div>
<h1>{{count}}</h1>
<p>
This instance is displayed in the mouse from the DIV Evaluate the variable when moving on the element "count" Will automatically add 1 . </p>
</body>
</html>
Definition and usage
The ng-mousemove instructions are used to tell AngularJS what to do when the mouse moves over an HTML element.
The ng-mousemove instruction does not override the element's native onmousemove event, and when the event is triggered, both the ng-mousemove expression and the native onmousemove event are executed.
Grammar
<
element ng-mousemove="expression"
>
<
/element
>
All HTML elements support this instruction.
Parameter value
值 | 描述 |
---|---|
expression | 鼠标在元素上移动时执行的表达式。 |
The above is to AngularJS ng-mousemove instruction of the basic knowledge of data collation, follow-up to continue to supplement!