Description of the Data Monitoring Mechanism in angularjs Data Binding

Source: Internet
Author: User


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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.