How does Angular change detection decide what to render?
Cover zone updates, OnPush, and why signals make the dependency explicit.
Points worth saying
- Default checking walks the component tree after a turn of work.
- OnPush checks a component when an input reference changes, an event fires inside it, or a mark is requested.
- Signals give the framework a precise list of reads.
A full answer
Angular needs to know when bindings might have changed. With the default strategy it checks component bindings after asynchronous work that it is notified about, then walks from the root.
OnPush narrows that walk. The component is checked when an input gets a new reference, when a DOM event originates in its template, or when you explicitly mark it. Mutating an object in place without changing the reference will not refresh an OnPush view.
That is the interview trap. If a parent replaces an array with a new array, the child updates. If the parent pushes into the same array, an OnPush child can stay stale. Immutable updates, or a signal that the child reads, remove the ambiguity.
Signals record which computations read them. When the signal changes, only dependents are notified. You still keep OnPush on components. The signal is the data contract; OnPush is the component contract.
Mark your progress
Create a practice profile to mark this question.