In the Angular docs it is mentioned, that in Lazy loading modules, components get local instances of services not the root level instances. Other module's components are using a root-level instance. Does this mean it creates 2 instances when we are using Lazy loading?
Case is:
We have Root Module AppModule, where we created a service(ServiceA) and injected at root level, but now we don't provide this service into the AppModule's providers[] like this only : imports: [ BrowserModule, RouterModule.forRoot(routes) ], providers: [],
Now in my lazy loaded module, I have to use the same service(ServiceA) just by importing it into some component of the lazily-loaded module.
Question: Does this create a separate instance of service(ServiceA) in the lazy loaded modules? Answer: Ideally it should create only one instance,
But due to this line I am confuse
Please help me with this understanding.