I'm curious about how to supply an injectable class in Angular (4+) that includes all of its dependencies.
For example:
If we have an injectable called DepMaster, which has dependencies such as:
DepServantA
DepServantB
Simply providing DepMaster alone does not work like this:
@Component({
// ...
providers: [
DepMaster
]
})
In order for it to function properly, we need to specify all dependencies and sub-dependencies individually, like so:
@Component({
// ...
providers: [
DepMaster
DepServant1,
DepServant2,
]
})
When providing DepMaster, ideally we should not have to worry about listing out all its dependencies. It would be convenient if simply providing DepMaster automatically included all necessary dependencies.
Having to maintain a detailed list of dependencies and sub-dependencies can become overwhelming. Any changes to a sub-dependency would require updating every usage instance, leading to code that relies heavily on implementation specifics.