Initial bundle size: Incorporated
async dynamically import(s)
for Components Modules at runtime, reducing the initial bundle size. The idea is to lazily load stand-alone Component modules when required, rather than having them eagerly loaded at application startup. Also Component Modules are initialised and removed from memory saving memory
-Efficient Memory Usage: Components are only in memory while they are rendered. Once removed, memory is freed. This approach prevents unnecessary memory bloat, especially for components that are infrequently used.
-
Dynamic Resource Loading: Lazy-loaded components are only loaded when needed, keeping the initial application size smaller and improving load times.
-
Garbage Collection: Since Angular removes the references to the component and clears the DOM, JavaScript's garbage collector can automatically clean up memory.
ComponentFactoryResolver was used to dynamically create components at runtime. However, starting from Angular 13+
, the ComponentFactoryResolver has been deprecated in favor of a more straightforward and modern approach using: ViewContainerRef.createComponent
https://medium.com/netanelbasal/dynamically-creating-components-with-angular-a7346f4a982d
This project was generated with Angular CLI version 18.2.9.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The application will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.