ltackmann/dice — pull request #8 by antonmoiseev (2013-09-24 22:44:41+00:00)
Title: Add ModuleContainer

Add `ModuleContainer` and convenient named factory constructor for `Injector` to address the problem of injecting classes from one module into a class from another module. As you can see implementation is simple and straightforward, it also doesn't break existing API. It works for our team, hope you will find it useful.

Example:

```dart
// Library package.
class DefaultProductService implements ProductService {}

class LibraryModule extends Module {
configure() {
bind(ProductService).toType(DefaultProductService);
}
}
```

```dart
// Main application package.
class CatalogPage {
@inject ProductService productService; // Class from Library module.
}

class AppModule extends Module {
configure() {
bind(CatalogPage).toType(CatalogPage);
}
}
```

```dart
// Usage in the main app
main () {
Injector injector = new Injector.fromModules([new LibraryModule(), new AppModule()]);
var catalogPage = injector.getInstance(CatalogPage);
}
```