Skip to content Skip to sidebar Skip to footer

Angular - Resolver And Component Not Sharing Injected Service?

I have a table to display some products in my products list component. There is a moderate amount of data, so I've added in a resolver to not land the user on the page until the da

Solution 1:

If you look at Angular documentation there is stated as follows "Do not specify app-wide singleton providers in a shared module. A lazy-loaded NgModule that imports that shared module makes its own copy of the service.."

So an service you want to have as an singleton should be provided in the Core module which you import once when the app starts and never import anywhere else.

Here is the link to the detailed explanation of the Core module.

Have a great day :)

Post a Comment for "Angular - Resolver And Component Not Sharing Injected Service?"