Digest Cycle is process responsible for data binding in Angular JS.
When I run my first Angular JS application I was amazed that how quickly Angular JS is detecting my changes. It has power to impress anybody who just started playing with Angular JS. On top of we don’t need to write lot of data binding related codes. It is taken care by Angular JS it self and you no need to worry much about it.
But it doesn’t mean that you need not understand it. It is very important understand what’s cooking there if you are on the path to develop good real life Angular JS application and wanted to enhanced your skill as expert Angular JS developer. So, Lets understand this process clearly.
So how exactly Angular is performing this “Magic”?
The answer is simple. Angular is doing dirty checking. Angular is keeping watch for the values in Scope. So it continuously keep watch. It compares new values with old values at particular interval. If it finds both values (old and new) are equal, it tooks no action. But if values are not same it will fire (execute) listener. This is recursive process means it listener can change value which will change another value. This process will continue until no more listener fires. In Angular JS world we call it digest cycle. It is triggered by $digest().
You can call $digest() using $apply() on demand basis.