Imagine the first bit of code I have here for IoC at an Angular module:
providers: [
Configuration,
{provide: IpContract, useClass: IpService}
]
What if IpService itself needs some stuff handed into it to make it work? Well, we could have a variant of what is above like this:
providers: [
Configuration,
{provide: IpContract, useFactory: IpService, deps: [Yin, Yang]}
]
Here is a trick to moreover refer to references in this ilk which are declared but not yet defined. The details may be filled in later.
providers: [
Configuration,
{provide: IpContract, useFactory: IpService, deps: forwardRef(() => IpMagic)}
]
No comments:
Post a Comment