0

I'm looking for a way to manipulate the current components Injector. I know that I can use :

constructor(private injector: Injector) { }

to get the injector, but there are no methods exposed on it that allow me to append services to the current injector rather than create a child injector. So is this just not possible or what?

  • What would you need that for? Why don't you want a child injector? It's not supported to modify created injectors. – Günter Zöchbauer Mar 14 '16 at 08:45
  • I would like to load in a service dynamically so that I can say, if they have access to this module, load this service, otherwise don't. If I put it in a child injector, I won't be able to access it from another child. So to illustrate a little: child injector < router component > child injector where the right child can't access the left one, but can access the parent. – studiollama Mar 17 '16 at 05:14
  • Doesn't sound like an easy to understand and maintainable approach. A concrete example in code might help to discuss possible alternative approaches. – Günter Zöchbauer Mar 17 '16 at 05:58

0 Answers0