#Dependency Injection Order

7 messages · Page 1 of 1 (latest)

small kraken
#

Hello!
I have a big project with services and interceptors. I am now struggling with the problem that the service I am injecting is an empty object. I think that is because it is injected before it has been intialized. How can I overcome this problem?

Thank you so much for help!

onyx parrot
#

How can a service be an empty object? How are you injecting it?

#

Maybe if you show an example where you get an empty object it might help

small kraken
#

I have it providedIn root, and the other service is also provided in root. I inject it thorugh constructor (tried inject() too). After I console.log it I get {}

onyx parrot
#

what exactly do you console log, whole service? Do you have any warnings/errors?

small kraken
#

Yeap I console log the whole injected service. I also added console log in the injected service constructor.

The console log in the constructor of the service I am trying to inject is called AFTER the console log in the constructor of the service I am trying to inject to.

#

No warnings or errors