简体   繁体   中英

Is digest cycle is the same as dirty checking?

Simple question, because i'm a little bit confused. Is digest loop (aka digest cycle) is the same thing as dirty checking in AngularJS? If not - what are the differences?

The digest cycle is run automatically by angular, it will check the models for changes until it does not detect any more changes to apply (or the loop reaches 10, as far as I know). Meaning that this is actually angular's way to perform "dirty checking". You can, however, manually trigger a digest cycle ( $apply ) in order to force angular to check for changes you've made without having to wait until the next digest cycle.

Here is a post i've found interesting that talks about the digest cycles and the $apply method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM