@NgModule decorator

Why is it bad if a shared module provides a service to a lazy-loaded module?

Why is it bad if a shared module provides a service to a lazy-loaded module?
The lazy loaded scenario causes your app to create a new instance every time, instead of using the singleton.
Lazy loading is the best practice of loading expensive resources on-demand. This can greatly reduce the initial startup time for single page web applications (SPA). Instead of downloading all the application code and resources before the app starts, they are fetched just-in-time (JIT), as needed.

The eagerly loaded scenario your app to create a singleton, instead of creates new instance every time.

Explore in depths about Lazy loading - https://angular-wbecxz.stackblitz.io/partners

ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

Why is it bad if a shared module provides a service to a lazy-loaded module? Why is it bad if a shared module provides a service to a lazy-loaded module? Reviewed by Anil Singh on 4:21 AM Rating: (5)
www.code-sample.com/. Powered by Blogger.
^