I currently have a service that generates an object for me which should behave as a sort of active record, in that it can then lazily fill itself as properties of it are accessed.
My first approach was having the services which the generated object uses injected into the creating service and just passing them to the constructor of the created object, but since the creating service never uses these, it seems kind of dirty.
The second apporach was to use a ReflectiveInjector:
let injector = ReflectiveInjector.resolveAndCreate(
[
ClassToBeCreated,
ServiceA,
ServiceB,
ServiceC
]
)
let created = injector.get(ClassToBeCreated)
But this crashes:
EXCEPTION: No provider for Http! (ClassToBeCreated -> ServiceA -> Http)
And if I specify Http in resolveAndCreate, it fails with the next dependency of Http.
Is there a way to inject without having to specify all the dependencies up the tree and let angular handle it?
Am I approaching this problem in a fundamentally wrong way?
Any help is greatly appreciated.