How do I get the root dependency injector in angular2? I cant inject the injector in the class constructor(lets assume its a constraint). So in the ideal case I would like to do something like this:
doStuffMethod(){
let di = getRootDI();
di.get(NeededType);
}
I know I can either inject the di into the constructor or configure a child dependency injector using ReflectiveInjector. But the problem is that I cant change the constructor signature and I have the right dependency already configured for the root injector.
**Edit: My question is not about putting stuff into a well know object aka ServiceLocator and resolve from there. The question thats suggested as a duplicate to mine is about how to get the reference to DI when its not yet there. After its there you put it into a service locator and you are done. I need to get the reference to root DI using angular and I need it when app is initialized.