How does change detection work in Angular, broadly speaking ?
Answer
Angular maintains a tree of components, and on every change detection cycle, it walks that tree to compare the current value of template-bound properties against their previous value, updating the DOM if a difference is detected. Historically, this cycle is triggered by Zone.js, which intercepts the browser's asynchronous events (clicks, timers, HTTP requests) to know when to run a detection pass across the whole application. With recent Angular versions and signals, part of this detection becomes finer-grained and targeted, without relying solely on Zone.js.
Common trap
The trap is believing change detection only triggers on a direct user action: a setTimeout, a resolved promise or an HTTP response trigger a detection cycle just as much, which explains some unexpected performance behaviors.