NG.VIII · Angular 22 practice question
A developer profiles an OnPush parent component (MainComponent) and sees it getting checked whenever an event is handled inside its OnPush child (LoginComponent). Why does Angular check MainComponent as well?
Check answer and explanation
Correct answer: Because LoginComponent is part of MainComponent's view
Explanation
Angular checks MainComponent when LoginComponent handles an event because LoginComponent is part of MainComponent's view.
Common trap
Developers sometimes assume nesting components invalidates OnPush, but OnPush remains active and simply checks ancestors whose view contains the event source. Events do not mutate parent input bindings; the parent is checked because the child belongs to its view.
Source: Angular docs: Skipping component subtrees — An event is handled by a descendant of a component with OnPush
Checked against the cited text on 2026-11-25.