简体   繁体   English

摘要循环是否与脏检查相同?

[英]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? 摘要循环(也称为摘要循环)与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). 摘要循环按角度自动运行,它将检查模型中的更改,直到没有检测到要应用的其他更改为止(据我所知,循环达到10个)。 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. 但是,您可以手动触发摘要循环( $apply ),以强制angular检查您所做的更改,而不必等到下一个摘要循环。

Here is a post i've found interesting that talks about the digest cycles and the $apply method. 这是我发现有趣的帖子 ,其中涉及摘要循环和$apply方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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