Parameter decorator that injects the instance associated with the given class.
Throws an error if the class is not registered in the container.
Parameter decorator that injects the value associated with the given token.
Throws an error if the token is not registered in the container.
Allows referencing a token that is declared later in the file by using the forwardRef helper function.
class Wizard { constructor(@Inject(forwardRef(() => Wand)) readonly wand: Wand) {}}// Other code...class Wand {} Copy
class Wizard { constructor(@Inject(forwardRef(() => Wand)) readonly wand: Wand) {}}// Other code...class Wand {}
Parameter decorator that injects the instance associated with the given class.
Throws an error if the class is not registered in the container.