When working with Angular 7 and Typescript, I have a base class that relies on multiple services and has around 40 subclasses. Instead of adding these services to each subclass constructor and passing them to super()
, I am looking for a more efficient way to use the services in all subclasses.
export class ParentTool {
constructor(type: string, public service1: Service1, public service2: Service2,public service3: Service3, public service4: Service4){}
}
export class ChildTool1 extends ParentTool {
constructor(public service1: Service1, public service2: Service2,public service3: Service3, public service4: Service4) {
super("tool1", service1, service2, service3, service4);
}
}
export class ChildTool2 extends ParentTool {
constructor(public service1: Service1, public service2: Service2,public service3: Service3, public service4: Service4) {
super("tool2", service1, service2, service3, service4);
}
}