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-mouseenter="count = count + 1" ng-init="count=0">Mouse over me!/div> <h1{{count}}</h1> <p> In this example, when the mouse passes over the 'DIV' element, the variable 'count' will automatically increase. 1。</p> </body> </html>Test and see ‹/›
ng-mouseenter The directive is used to tell AngularJS what operation to perform when the mouse passes over an HTML element.
ng-mouseenter The directive does not override the element's native onmouseenter event, when the event is triggered,ng-mouseenter Both the expression and the native onmouseenter event will be executed.
<element ng-mouseenter="expression"></element>
All HTML elements support this directive.
Value | Description |
---|---|
expression | An expression that is executed when the mouse passes over an element. |