AngularJS ng-mouseleave directive
AngularJS instance
Execute 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">Mouse is removed from me!</div><h1>{{count}}</h1><p>This instance will automatically add 1 to the calculation variable "count" when the mouse is removed from the DIV element. </p></body></html>Definition and usage
The ng-mouseleave directive is used to tell AngularJS what to do when moving the mouse away from an HTML element.
The ng-mouseleave directive will not overwrite the element's native onmouseleave event. When the event is triggered, both the ng-mouseleave expression and the native onmouseleave event will be executed.
grammar
<element ng-mouseleave="expression"></element>
All HTML elements support this directive.
Parameter value
| value | describe |
|---|---|
| Expression | The expression that the mouse executes when the element is removed. |
The above is the basic information sorting out the AngularJS ng-mouseleave directive, and the relevant information will be added in the future.