Change detection
Angular can feel pretty magical when you start using it.
For instance, how does it know when inputs change? How does it re-render elements? We won't be able to delve very deeply into how things work under the hood, but we can at least give you a rough idea.
When Angular is loaded, it patches many browser APIs in order to know when some things happen. Most of these patches are handled by the zone.js (https://github.com/angular/zone.js) library that Angular uses (and which might also get standardized at some point in the future). Thanks to those patches, Angular knows when buttons are clicked on, when event listeners are triggered, when (most) asynchronous operations are completed, and more.
When Angular notices that something ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access