-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inject container in dependency #1486
Comments
👍 We are encountering the same issue while migrating from typed-inject which provides this feature. Did you find a workaround @Deathrage? |
@vhiairrassary yes container.bind(Container).toDynamicValue(ctx => ctx.container as Container); But this is somewhat a hack as |
Thank you so much 🤩 Hopefully the feature will be implemented at some point in the project 🤞 |
Closing the issue. Consider providing the container through a binding the same way any other object can be provided |
Expected Behavior
Generally IoC container allow self injection. I will demonstrate in C#. This is to demonstrate that this approach is common and supported by other frameworks (example below demonstrate .NET Core's IoC container).
In this case, constructor recieve instance that is constructing given type. This means that child containers propagte their own instance.
Usecase in TypeScript:
Current Behavior
Uncaught Error: No matching bindings found for serviceIdentifier: Container
at _validateActiveBindingCount (planner.js:59:1)
at _getActiveBindings (planner.js:45:1)
at _createSubRequests (planner.js:86:1)
at planner.js:110:1
at Array.forEach ()
at planner.js:109:1
at Array.forEach ()
at _createSubRequests (planner.js:89:1)
at plan (planner.js:131:1)
at container.js:598:31
Your Environment
The text was updated successfully, but these errors were encountered: