With a model hierarchy like this:
export class A {
constructor() {
// Here service X is needed for some own functions
}
}
export class B extends A {
constructor() {
// Here service Y is needed for some own functions
super( ... )
}
}
export class C extends B {
constructor(parent, data) {
super( ... )
}
}
I want to instance C objects. So the questions are:
How do i inject X
and Y
services?
- Should i put all of them on the
C
constructor, and pass them to the base classes withsuper
? - Can they be mixed with the already existing parameters
parent
anddata
? - There is some way i can inject only
Y
at theB
level, andX
at theA
level? So somehow i avoid passing those references on thesuper
?