Thanks for the great work on this! Was looking for something like this for Javascript as I was a huge fan of DI done in Robotlegs for AS3!
Quick question:
I've got a backbone project that I'd like to use DI with. I've used your framework and I can sort of get it to work the way I want but alas, I feel
that the way I'm using your injection is more as a global repository rather than as straight DI within classes.
Basically my issue is how can I pass the required dependencies to my Backbone classes?
At the moment I'm creating the container class, assigning dependencies..but...
then I add the injector to my custom command & view classes via the prototype:
_.extend(Drafted.Commands.Base.prototype.injector, container);//all command classes inherit injector
_.extend(Drafted.Views.QuestionSliderView.prototype.injector, container);
Within my classes I get the dependencies i need via something like this:
var currItem = this.injector.get("currentQuestionItem");
I feel i'm not going about it the right way :(
Following your example I'd like to be able to access the dependencies as if they were already declared in the class.
Any advice?? :)
Once again thx for a great framework!
cheers
erick