how How often does the AngularJS digest loop run?
When discussing the merits of AngularJS, two-way data binding is often touted as a major benefit of Angular over other JS frameworks. Digging deeper, the documentation suggests this process is done through dirty-checking rather than through event-driven measures. At first, it seems that the digest-loop works by having a method fire off in the background at periodic intervals, checking all the
But, how can this be? I thought Angular doesn’t use change listeners. So how does the digest-loop really operate? Does Angular automatically kick-off the digest-loop internally, or is the digest-loop triggered by events? If the digest-loop is run automatically, how often does it run?
Some clarification points:
Angular digests are triggered – they don’t happen through polling.
Code executes, after code is done, angular triggers a digest.
Angular will also trigger a $digest after the compile/link phase:
And as to how many digest cycles are triggered? It depends on how soon the scope variables stabalise. Usually it takes at least 2 cycles to determine that.