inversify / InversifyJS

A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
http://inversify.io/
MIT License
11.02k stars 712 forks source link

How to inject method parameter #1540

Open imcm7 opened 9 months ago

imcm7 commented 9 months ago

How to inject method parameter

@inject()
Class Name {

    doSomething(
        @inject() test: string
    ) {
        console.log(string);
    }
skalinkin commented 9 months ago

This question appears to be out of context. The primary role of a DI (Dependency Injection) container is to inject dependencies into a constructor rather than injecting parameters into arbitrary functions. It is highly likely that you're attempting to achieve a goal that this library was not designed for.