返回到:AngularJS 参考手册
定义和用法
ng-mouseenter 指令用于告诉 AngularJS 鼠标在 HTML 元素穿过时要执行的操作。
ng-mouseenter 指令不会覆盖元素的原生 onmouseenter 事件, 事件触发时,ng-mouseenter 表达式与原生的 onmouseenter 事件将都会执行。
语法
<element ng-mouseenter="expression"></element>
所有的 HTML 元素支持该指令。
参数值
值 | 描述 |
---|---|
expression | 鼠标穿过元素时执行的表达式。 |
AngularJS 实例
在鼠标指针穿过元素时执行表达式:
<!DOCTYPE html> <html> <head> <title>AngularJS 实例 | Web176教程网web176.com</title> <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">鼠标穿过我!</div> <h1>{{count}}</h1> <p> 该实例在鼠标穿过 DIV 元素时,计算变量 "count" 会自动加 1。</p> </body> </html>
返回到:AngularJS 参考手册
作者:terry,如若转载,请注明出处:https://www.web176.com/angularjsapi/6411.html