I have a component that dynamically loads another component using DynamicComponentLoader. However, the dynamic component needs to have a service injected. However, I'm unsure how to go about this. I see from Angular.io docs that DynamicComponentLoader accepts a ResolvedProvider array.
I've tried to get a provider by doing:
var provider = provide(ManagerService, {useExisting: ManagerService});
dcl.loadIntoLocation(this.data.template, this.er, "content",[provider]);
This doesn't seem to work. You can see an example on plunker.
On the plunker example, you can see that the Info component loads (because it isn't requiring the service) but the Alternate component won't load.
I'm a little confused because the service is being injected at the root component so I thought that it would automatically be injected on every child component when it was called for.
How do I get this service injected?