0

I was recently going through a pretty interesting article about data binding in angularJS. I came across a term there : 'Dirty-Checking', which is performed during a $digest operation. The term sounded quite interesting to me but unfortunately, didn't make much sense about what's dirty over there. Does it concern the constant check on some value ?

Community
  • 1
  • 1
NewBee
  • 41
  • 1
  • 7

1 Answers1

0

The term dirty checking refers to the process of comparing values from before a change ($digest cycle) and after a change.

This blog does a pretty good job explaining the details.

So, when the digest cycle runs in Angular, all the watched scope values (bound to the ui, or using $watch) are traversed. Each value is resolved and then compared to the value in a previous digest. So, it is checking if the values have been changed (whether they are dirty).

Hope this helps.

Davin Tryon
  • 66,517
  • 15
  • 143
  • 132
  • Thanks for your answer Davin. I went through the blog link you provided. Sorry to say but I think it's meaning is bit different from the last line you mentioned. The term dirty-check is probably named so because there is 'watch' associated with every'$scope value' instead checking if the values have been changed (whether they are dirty). Just trying to clear my concepts. :) – NewBee Jun 13 '16 at 08:45