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 指令的基礎資料整理,後續繼續補充相關資料。