NG.VIII · Angular 22 practice question
A parent template passes a bound value to an input on an OnPush subtree's root component. How does Angular compare the previous and current input values to decide whether the component received a new input?
Check answer and explanation
Correct answer: Object.is comparison between the current and previous values
Explanation
Angular compares the previous and current input values using Object.is to determine whether a template binding delivered a new input to the subtree's root component.
Common trap
Deep structural comparison is expensive and would defeat OnPush's performance benefits, so Angular does not walk nested properties. Serializing with JSON.stringify fails on circular references and functions and is never used by Angular for input change checks.
Source: Angular docs: Skipping component subtrees — Using `OnPush`
Checked against the cited text on 2026-11-25.