From d8103aeca61f140b6dd3db017f2dd8091fe2d98b Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Sat, 21 Feb 2015 17:14:01 +0100 Subject: [PATCH] docs(di): fix code examples Closes #750 --- modules/angular2/docs/di/di.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/angular2/docs/di/di.md b/modules/angular2/docs/di/di.md index 549762b57f..0e8cce8ffc 100644 --- a/modules/angular2/docs/di/di.md +++ b/modules/angular2/docs/di/di.md @@ -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 ```