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 do I inject a class rather than an instance of a class? #21

Closed
@RGBboy

Description

@RGBboy

This is a simplified version of what I am trying to do:

export class Factory {

  @Inject(MyClass)
  constructor (MyClass) {
    this.MyClass = MyClass;
  }

  create () {
    return new this.MyClass();
  }

}

export class MyClass {
  ...
}

Is there a way to get DI to pass a class rather than an instance of a class?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions