- In this article I will talk in depth about the Angular 2 change detection system.High-Level OverviewAn Angular 2 application is a tree of components.An Angular 2 application is a reactive system, with change detection being the core of it.Every component gets a change detector responsible for checking the bindings defined in its template.
- So it cannot see the changes in individual todos.The way to handle it is to check the path from the root to the changed Todo component when its todo observable fires an event.
- The change detection system will make sure this happens.Say our application uses only observable objects.
- The system will switch to the following state:And after checking App_ChangeDetector, Todos_ChangeDetector, and the first Todo_ChangeDetector, it will go back to this state.Assuming that changes happen rarely and the components form a balanced tree, using observables changes the complexity of change detection from O(N) to O(logN), where N is the number of bindings in the system.This capability is not tied to any particular library.
- Even in such a case the change detection system will minimize the number of checks required to propagate changes.SummaryAn Angular 2 application is a reactive system.The change detection system propagates bindings from the root to leaves.Unlike Angular 1.
How would you rate this content? Change Detection in Angular 2 > https://t.co/NzetvMddYE
— AngularJS News (@AngularJS_News) July 27, 2017