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 元素支持該指令。
參數值
以上就是對AngularJS ng-mouseenter 指令的基礎資料整理,後續繼續補充相關資料。