This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
How can I instantiate a class with injected arguments and custom arguments? #22
Open
Description
export class MyClass {
@Inject(Service)
constructor (service, customArgument) {
this.service = service;
}
...
}
My application has many instances of MyClass
each instantiated with different customArgumnent
. Is there a way to get DI to provide the injected arguments? I was thinking something similar to how in angular you can provide locals to the $injector.instantiate(expression, locals):
injector.instantiate(MyClass, { customArgument: 'customArgument' });