分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Angularjs(1.x)和Angular(2+)数据脏检测之间的区别

发布时间:2023-09-06 02:21责任编辑:傅花花关键词:jsAngular

转2篇个人认为写的很好的:

Angularjs(1.x)  http://www.cnblogs.com/likeFlyingFish/p/6183630.html

Angular(2+)  https://blog.csdn.net/u011256637/article/details/71056731?utm_source=itdadao&utm_medium=referral

以及总结:(原出处:https://blog.angular-university.io/how-does-angular-2-change-detection-really-work/ )

The Angular default change detection mechanism is actually quite similar to Angular 1: it compares the values of templates expressions before and after a browser event to see if something changed. It does so for all components.

But there are also some important differences:

For one there are no change detection loops, or a digest cycle as it was named in Angular 1. This allows to reason about each component just by looking at its template and its controller.

Another difference is that the mechanism of detecting changes in a component is much faster due to the way change detectors are built.

Finally and unlike in Angular 1, the change detection mechanism is customizable.

附翻译:

Angular 默认更改检测机制实际上与Angular 1非常相似:它比较浏览器事件之前和之后的模板表达式的值,以查看是否有更改。它适用于所有组件。

但也存在一些重要的差异:

对于一个没有变化检测循环,或者在Angular 1中命名的脏值循环。这允许仅通过查看其模板及其控制器来推断每个组件。

另一个不同之处在于,由于构建变化检测器的方式,检测组件中的变化的机制要快得多。

最后,与Angular 1不同,更改检测机制是可定制的。

Angularjs(1.x)和Angular(2+)数据脏检测之间的区别

原文地址:https://www.cnblogs.com/jimaww/p/9922882.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved