Eager Loading, Lazy Loading Strategies In Angular
Angular has provided 3 types of module loading strategies. Every module loading strategy has its own way of implementation. In this post, we will know about what is the basic definition and benefits of every loading strategy. Why we use loading strategy ? It is necessary to load the feature modules or components that are required to render an application. Based on our requirements, We need to know which loading strategies will suitable to our application. 1. Eager Loading 2. Lazy Loading 3. Pre Loading Eager Loading : It is the default loading strategy to load the components in angular application. It is useful in small size applications. In Eager Loading all the components will be loaded before the application starts . It makes subsequent request to the application will be very faster. In Eager loading, all the components will import in app.module.ts. Lazy Loading : It loads only the required feature modules to render the page in application. In Lazy l...