Search code examples
javascriptangularjsmousehover

Angularjs - How to execute ng-mouseenter once


I have a problem, how to execute ng-mouseenter or ng-mousehover just once

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

How to keep that "1" on count?


Solution

  • use like this

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

    IF count == 0 then execute the count = count + 1 ELSE just return.

    DEMO PLUNKER