AngularJS ng-mouseenter 指令

AngularJS 參考手冊(cè) AngularJS 參考手冊(cè)


AngularJS 實(shí)例

在鼠標(biāo)指針穿過(guò)元素時(shí)執(zhí)行表達(dá)式:

<div ng-mouseenter="count = count + 1" ng-init="count=0">鼠標(biāo)穿過(guò)我!</div>

<h1>{{count}}</h1>

嘗試一下 ?

定義和用法

ng-mouseenter 指令用于告訴 AngularJS 鼠標(biāo)在 HTML 元素穿過(guò)時(shí)要執(zhí)行的操作。

ng-mouseenter 指令不會(huì)覆蓋元素的原生 onmouseenter 事件, 事件觸發(fā)時(shí),ng-mouseenter 表達(dá)式與原生的 onmouseenter 事件將都會(huì)執(zhí)行。


語(yǔ)法

<element ng-mouseenter="expression"></element>

所有的 HTML 元素支持該指令。


參數(shù)值

描述
expression 鼠標(biāo)穿過(guò)元素時(shí)執(zhí)行的表達(dá)式。

AngularJS 參考手冊(cè) AngularJS 參考手冊(cè)