What is change detection in Angular in simple terms?
Model answer
Change detection is how Angular keeps the screen in sync with your data. When something may have changed, Angular checks the bindings in your templates, such as {{ name }} or [disabled]="saving", compares them with the previous values, and updates the DOM only where the value is different.
Angular needs to know when to check. Historically, a library called zone.js patched browser APIs, so after a click, a timer or an HTTP response Angular ran a check automatically. Today, signals let Angular know exactly which views read a changed value, and zoneless apps rely on that instead of zone.js.
By default Angular checks the whole component tree from the top. With OnPush, a component is checked only when:
- an input reference changes,
- an event fires inside it,
- a signal it reads changes, or the
asyncpipe emits, - or you call
markForCheck().
You rarely call change detection yourself. It runs for you after events and signal updates.
Think of it as Angular re-reading your bindings after something happens.
Key points
- Angular compares template bindings with previous values and updates the DOM
- zone.js historically triggered checks after async events
- Signals and zoneless give precise triggers
- OnPush limits when a component is checked
Likely follow-ups
- What is the difference between the Default and OnPush strategies?
Common mistakes
- Thinking Angular re-renders the whole page on every change
- Calling detectChanges manually to fix problems instead of finding the cause