AngularJS ng-mouseenter 指令
AngularJS 实例
在鼠标指针穿过元素时执行表达式:
<!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-mouseenter="count = count + 1" ng-init="count=0">鼠标穿过我!</div>
<h1>{{count}}</h1>
<p>
该实例在鼠标穿过 DIV 元素时,计算变量 "count" 会自动加 1。</p>
</body>
</html>
定义和用法
ng-mouseenter 指令用于告诉 AngularJS 鼠标在 HTML 元素穿过时要执行的操作。
ng-mouseenter 指令不会覆盖元素的原生 onmouseenter 事件, 事件触发时,ng-mouseenter 表达式与原生的 onmouseenter 事件将都会执行。
语法
<element ng-mouseenter="expression"></element>
所有的 HTML 元素支持该指令。
参数值
值 |
描述 |
expression |
鼠标穿过元素时执行的表达式。 |
以上就是对AngularJS ng-mouseenter 指令的基础资料整理,后续继续补充相关资料。