NG.VIII · Angular 22 practice question
An OnPush subtree root contains a child component that does not use OnPush. When Angular handles a @HostListener event on that child component, what happens to change detection for the subtree?
Check answer and explanation
Correct answer: Angular runs change detection for the subtree regardless of whether the child uses OnPush
Explanation
Angular runs change detection for an OnPush subtree whenever it handles an event—such as an event binding, output binding, or @HostListener—in the subtree root or any descendant, whether or not that descendant uses OnPush.
Common trap
It is easy to think a non-OnPush child behaves differently under an OnPush root, yet handled events in any child trigger change detection for the subtree regardless of the child's strategy. Developers sometimes assume only template (event) bindings trigger OnPush, overlooking that output bindings and @HostListener events trigger it as well.
Source: Angular docs: Skipping component subtrees — Using `OnPush`
Checked against the cited text on 2026-11-25.