Deferring components
Introducing the new control flow syntax enabled Angular to integrate new primitives in the framework, improving the ergonomics, DX, and performance of Angular applications. One such primitive is deferrable views, which allow lazily loading an Angular component and its dependencies.
Introducing deferrable views
We have already learned how to use the Angular router for lazy loading a component based on a specific route. Deferrable views provide a new API that supplements the preceding one. Combining it with lazy-load routing guarantees the development of high-performance and powerful web applications. Deferrable views allow us to lazy load a component based on an event or the component state and have the following characteristics:
- They are simple to use and easy to reason about the enclosed code
- We define them in a declarative way
- They minimize the initial application load and final bundle size, improving CWV metrics such as LCP and...