Angularjs - 如何执行ng-mouseenter一次

时间:2015-05-07 15:43:55

标签: javascript angularjs mousehover

我遇到问题,如何只执行一次ng-mouseenterng-mousehover

http://plnkr.co/edit/CIdFhCJR8SOatjoDgd8m?p=preview

如何保持" 1"在计数?

1 个答案:

答案 0 :(得分:4)

像这样使用

<button ng-mouseover="(count == 0) ? count = count + 1 : return" ng-init="count=0">

IF count == 0然后执行count = count + 1 ELSE return

DEMO PLUNKER