Angularjs $ $phase

Source: Internet
Author: User

https://segmentfault.com/q/1010000000738004/a-1020000000738812

$ $phase is a state flag bit used internally by Angluar to identify whether the current is in the digest state.

There is usually no need to care about this state in the program (two $ starts to say it is internally used), if you write a code that needs to care about this state, such as this safeapply, there must be something wrong.

    1. $digest is the watcher array used to execute the registration.
    2. $apply is used to enforce a dirty check in an extra digest loop.
    3. $ $phase is used to indicate whether the current is in digest
    4. $watch is used to register the watcher
Scope.prototype.$watch = function(WATCHFN,Listenerfn,Valueeq){  varWatcher= {    WATCHFN:Watchfn,    LISTENERFN:Listenerfn|| function(){    },     Last:Initwatchval,    Valueeq: !!Valueeq};   This.$ $watchers.Push(watcher);   This.$ $lastDirtyWatch = NULL;};

Angularjs $ $phase

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.