When a component extends another component and the base component has dependencies, I declare them in the child component and call super()
with the dependencies.
This becomes quite troublesome if the component needs 2 dependencies (service1, service2) and the base component needs 3 other dependencies (service3, service4, service5).
I'll have to do it like this
export class ChildComponent extends ParentComponent {
constructor(service1: ServiceType1,
service2: ServiceType2,
service3: ServiceType3,
service4: ServiceType4,
service5: ServiceType5) {
super(service3,service4,service5);
}
}
Question
Is there a way to do this where I won't have to declare every single dependency my parent component needs?
I was considering maybe injecting an Injector and ask the service to provide it's own dependencies through the injector - is that possible?