0

In my child (NavBarComponent) and parent(HeaderComponent) components I'm using changeDetection: ChangeDetectionStrategy.OnPush. When I change totally separated components that in no way are connected to my components, without any @Input(), my components begin to run the ngDoCheck() method.

enter image description here

My components are not even close in hierarchy to component I manually change(I change field from form), they related to header. So my question is: Why it's happen? With OnPush strategy is supposed to not happen. My Header and Navbar components should update only when the input property comes. Please help me figure it out.

  ngDoCheck(): void {
    console.log("change detection run ... (HeaderComponent)");
  }
Ярослав
  • 148
  • 2
  • 10

0 Answers0