我有一个复杂的组件,其中包含许多 @Input() 和异步进程。我想优化组件,因此打算在我的组件上分析 Angular4 更改检测周期。
我可以知道如何识别Angular4 更改检测系统是否正在被触发,以及 DOM 是否正在重新呈现?
可能,使用console.log(...)?
通常,我希望类似(在浏览器控制台中):
Change-detection running... no changes... 1
Change-detection running... no changes... 2
Change-detection running... no changes... 3
Change-detection running... no changes... 4
Change-detection running... changed
No DOM rendering
Change-detection running... no changes... 5
Change-detection running... no changes... 6
Change-detection running... changed
DOM re-rendered
Change-detection running... no changes... 7
Change-detection running... no changes... 8
Run Code Online (Sandbox Code Playgroud)
我如何实现这一目标?或者你们如何优化 Angular4 的性能?还有其他方法吗?
angular ×1