From: http://docs.angularjs.org/guide/scope
When the browser callinto JavaScript the code executes outside the angular execution context, which means that angular is unaware of model modifications. to properly process model modifications the execution has to enter the angular execution context using
The$ ApplyMethod. Only Model
Modifications which execute inside$ ApplyMethod will be properly accounted for by angular. For example if a directive listens on DOM events, such
AsNG-clickIt must evaluate
Expression inside$ ApplyMethod.
After evaluating the expression,$ ApplyMethod performs$ Digest.
In the $ digest phase the scope examines all of$ WatchExpressions and compares them with the previous value. This dirty checking is done asynchronously.
This means that assignment such$ Scope. Username = "Angular"Will not immediately cause$ WatchTo
Be notified, instead$ WatchNotification is delayed until$ DigestPhase.
This delay is desirable, since it coalesces multiple model updates into one$ WatchNotification as well as it guarantees that during$ WatchNotification
No other$ WatchEs are running. If$ WatchChanges
The value of the model, it will force additional$ DigestCycle.