天天看點

Angular Component的預設changeDetection政策

Angular Component的預設changeDetection政策

實作代碼:

Angular Component的預設changeDetection政策
Angular Component的預設changeDetection政策

而OnPush是另一種政策,用于提高Angular 應用的性能。

在OnPush工作模式下,隻有input ref change和output’s call會觸發change detection機制。

TestBed.overrideComponent提供了一種能夠覆寫标準ChangeDetectionStrategy的機制。

繼續閱讀