AngularJS Basic ng mouseleave Instructions Detailed Explanation
- 2021-07-07 06:17:44
- OfStack
AngularJS ng-mouseleave Directive
AngularJS instance
Executes the expression when the mouse pointer leaves the 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-mouseleave="count = count + 1" ng-init="count=0"> Move the mouse away from me !</div>
<h1>{{count}}</h1>
<p>
This instance is displayed in the mouse from the DIV When the element is removed, the variable is evaluated "count" Will automatically add 1 . </p>
</body>
</html>
Definition and usage
The ng-mouseleave instructions are used to tell AngularJS what to do when the mouse is removed from the HTML element.
The ng-mouseleave instruction does not override the element's native onmouseleave event, and when the event is triggered, both the ng-mouseleave expression and the native onmouseleave event are executed.
Grammar
<
element ng-mouseleave="expression"
>
<
/element
>
All HTML elements support this instruction.
Parameter value
值 | 描述 |
---|---|
expression | 鼠标在元素上移开时执行的表达式。 |
The above is the basic data collation of AngularJS ng-mouseleave instruction, and the relevant data will be supplemented in the future.