0

I'm triggering tick() and detectChanges() in the root component. In root component I have one child with onPush strategy, which logically means it shouldn't triger that child component if data has not changed.

Really small example about this issue: https://github.com/michalgrzegorczyk-dev/change-detection

Why ChildWrapperComponent runs ngDoCheck() in this case? It's OnPush! Why?

NgZone is disabled. The reset of the components works as expected, only root components are triggerend even it's OnPush.

1 Answers1

2

When you run detectChanges() manually, the component itself and all the children will be checked for changes.

Docs: detectChanges()

Checks this view and its children. Use in combination with detach to implement local change detection checks.

Angular|Detect Changes

StPaulis
  • 2,844
  • 1
  • 14
  • 24