简体   繁体   中英

Angularjs: Prevent dirty check on mouseenter/mouseleave event

In Angular, is there a way to prevent dirty check on such event?

Actually, my code in these handlers do not change the model so I don't want Angular to perform dirty check on these very often triggered event.

You can keep track of your inputs using Angular FormController ( documentation here ).

You have these properties:

  • $pristine - True if user has not interacted with the form yet.
  • $dirty - True if user has already interacted with the form.

which means you don't need to worry about mouseenter / mouseleave .

Also, you can find this detailed tutorial on the matter:

http://mrbool.com/the-concepts-of-angularjs-forms/29117

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM