Skip to content
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
@RGBboy

Description

@RGBboy
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' });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions