Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//Dependency injection
// the Module object
var Module = function (someService) {
this.someService = someService;
};
Module.prototype.do = function () {
this.someService.doSomething();
};
// configuring the injector
Injector.add('someService', new SomeService());
// retrieving the module instance with the SomeService being injected
var module = Injector.get(Module);
module.do();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.