Skip to content

Commit d8103ae

Browse files
pkozlowski-opensourcemhevery
authored andcommitted
docs(di): fix code examples
Closes angular#750
1 parent 895b2a7 commit d8103ae

File tree

1 file changed

+6
-6
lines changed
  • modules/angular2/docs/di

1 file changed

+6
-6
lines changed

modules/angular2/docs/di/di.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ You can bind to a class, a value, or a factory. It is also possible to alias exi
100100

101101
```
102102
var inj = new Injector([
103-
bind(Car).toClass(Car)
104-
bind(Engine).toClass(Engine);
103+
bind(Car).toClass(Car),
104+
bind(Engine).toClass(Engine)
105105
]);
106106
107107
var inj = new Injector([
@@ -124,7 +124,7 @@ You can bind any token.
124124
```
125125
var inj = new Injector([
126126
bind(Car).toFactory((e) => new Car(), ["engine!"]),
127-
bind("engine!").toClass(Engine);
127+
bind("engine!").toClass(Engine)
128128
]);
129129
```
130130

@@ -360,7 +360,7 @@ Or we can register a factory function:
360360

361361
```
362362
var inj = new Injector([
363-
bind('MyClassFactory').toFactory(dep => () => new MyClass(dep), [SomeDependency]);
363+
bind('MyClassFactory').toFactory(dep => () => new MyClass(dep), [SomeDependency])
364364
]);
365365
366366
var inj.get('MyClassFactory')();
@@ -374,7 +374,7 @@ Most of the time we do not have to deal with keys.
374374

375375
```
376376
var inj = new Injector([
377-
bind(Engine).toFactory(() => new TurboEngine()); //the passed in token Engine gets mapped to a key
377+
bind(Engine).toFactory(() => new TurboEngine()) //the passed in token Engine gets mapped to a key
378378
]);
379379
var engine = inj.get(Engine); //the passed in token Engine gets mapped to a key
380380
```
@@ -385,7 +385,7 @@ Now, the same example, but with keys
385385
var ENGINE_KEY = Key.get(Engine);
386386
387387
var inj = new Injector([
388-
bind(ENGINE_KEY).toFactory(() => new TurboEngine()); // no mapping
388+
bind(ENGINE_KEY).toFactory(() => new TurboEngine()) // no mapping
389389
]);
390390
var engine = inj.get(ENGINE_KEY); // no mapping
391391
```

0 commit comments

Comments
 (0)