Open Austaras opened 3 years ago
You can already do this, I guess, by assigning the container to a private member as you have suggested. But perhaps I'm not fully understanding the full context here - could you provide a fuller example of how you would like this to work?
Yes I could assign it to a member, however for complex requirment like hierarchy inject I'd like to get child container instead of root container. Of course I could pass it manually -- but I think it's better to automate this process
@inject
class A {
constructor(private container: Container) {}
run() {
this.container.resolveAll()
}
}
In angular we could
so that we can get depenency dynamically at any time instead of when construted, this is specifically useful for inject multi instance like http interceptor. I guess it's already possible for tsyringe to do so, only thing needed is a standard token and some modify to container factory