From 4da65d0e8c6a3bfbe5b2c4ad5708a39e750f739a Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Sun, 20 Mar 2011 21:49:06 -0700 Subject: Fixes some links and types in the DI docs. --- docs/guide.di.ngdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/guide.di.ngdoc b/docs/guide.di.ngdoc index 7c89c578..2d1f92eb 100644 --- a/docs/guide.di.ngdoc +++ b/docs/guide.di.ngdoc @@ -111,7 +111,7 @@ for isolation reasons. We get this isolation by having each test create its own
 // crate a root scope
 var rootScope = angular.scope();
-// accesss the service loctor
+// accesss the service locator
 var myService = rootScope.$service('myService');
 
@@ -136,7 +136,7 @@ MyController.$inject = ['$route']; In this example, the `MyController` constructor function takes one argument, the -(@link angular.service.$route $route) service. Angular is then responsible for supplying the +{@link angular.service.$route $route} service. Angular is then responsible for supplying the instance of `$route` to the controller when the constructor is instantiated. There are two ways to cause controller instantiation – by configuring routes with the $route service or by referencing the controller from the HTML template, such as: @@ -260,8 +260,8 @@ rootScope.$service(greet, fnThis, 'world'); # Inferring `$inject` -** EXPERIMENTAL: this is an experimental feature, see the important note at the end of this section -for drawbacks. ** +**EXPERIMENTAL: this is an experimental feature, see the important note at the end of this section +for drawbacks.** We resort to `$inject` and our own annotation because there is no way in JavaScript to get a list of arguments. Or is there? It turns out that calling `.toString()` on a function returns the function @@ -286,7 +286,7 @@ fnA.$inject = ['$window', 'serviceA']; // inject '$window', 'serviceA', curry 'name'; function fnB($window, serviceA_, name){}; -// implies: fnA.$inject = ['$window', 'serviceA']; +// implies: fnB.$inject = ['$window', 'serviceA']; If angular does not find an `$inject` annotation on the function, then it calls the `.toString()` @@ -301,4 +301,4 @@ and tries to infer what should be injected using the following rules: Minifiers/obfuscators change the names of function arguments and will therefore break the `$inject` inference. For this reason, either explicitly declare the `$inject` or do not use minifiers/obfuscators. In the future, we may provide a pre-processor which will scan the source code -and insert the `$inject` into the source code so that it can be minified/obfuscated. \ No newline at end of file +and insert the `$inject` into the source code so that it can be minified/obfuscated. -- cgit v1.2.3