docs(di): fix code examples

Closes #750
This commit is contained in:
Pawel Kozlowski 2015-02-21 17:14:01 +01:00 committed by Misko Hevery
parent 895b2a7bdf
commit d8103aeca6
1 changed files with 6 additions and 6 deletions

View File

@ -100,8 +100,8 @@ You can bind to a class, a value, or a factory. It is also possible to alias exi
```
var inj = new Injector([
bind(Car).toClass(Car)
bind(Engine).toClass(Engine);
bind(Car).toClass(Car),
bind(Engine).toClass(Engine)
]);
var inj = new Injector([
@ -124,7 +124,7 @@ You can bind any token.
```
var inj = new Injector([
bind(Car).toFactory((e) => new Car(), ["engine!"]),
bind("engine!").toClass(Engine);
bind("engine!").toClass(Engine)
]);
```
@ -360,7 +360,7 @@ Or we can register a factory function:
```
var inj = new Injector([
bind('MyClassFactory').toFactory(dep => () => new MyClass(dep), [SomeDependency]);
bind('MyClassFactory').toFactory(dep => () => new MyClass(dep), [SomeDependency])
]);
var inj.get('MyClassFactory')();
@ -374,7 +374,7 @@ Most of the time we do not have to deal with keys.
```
var inj = new Injector([
bind(Engine).toFactory(() => new TurboEngine()); //the passed in token Engine gets mapped to a key
bind(Engine).toFactory(() => new TurboEngine()) //the passed in token Engine gets mapped to a key
]);
var engine = inj.get(Engine); //the passed in token Engine gets mapped to a key
```
@ -385,7 +385,7 @@ Now, the same example, but with keys
var ENGINE_KEY = Key.get(Engine);
var inj = new Injector([
bind(ENGINE_KEY).toFactory(() => new TurboEngine()); // no mapping
bind(ENGINE_KEY).toFactory(() => new TurboEngine()) // no mapping
]);
var engine = inj.get(ENGINE_KEY); // no mapping
```