From 4581b79bbda74de7f4abc136187fe5574892b39c Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 23 Mar 2012 16:54:48 -0700 Subject: doc(guide/controller): fix examples --- .../guide/dev_guide.di.using_di_controllers.ngdoc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'docs/content/guide') diff --git a/docs/content/guide/dev_guide.di.using_di_controllers.ngdoc b/docs/content/guide/dev_guide.di.using_di_controllers.ngdoc index 6f254eaa..6d1ff04b 100644 --- a/docs/content/guide/dev_guide.di.using_di_controllers.ngdoc +++ b/docs/content/guide/dev_guide.di.using_di_controllers.ngdoc @@ -6,18 +6,17 @@ The most common place to use dependency injection in angular applications is in dev_guide.mvc.understanding_controller controllers}. Here is a simple example:
-function MyController($route){
- // configure the route service
- $route.when(...);
+function MyController($location){
+ // do stuff with the $location service
}
-MyController.$inject = ['$route'];
+MyController.$inject = ['$location'];
In this example, the `MyController` constructor function takes one argument, the {@link
-api/angular.module.ng.$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, as follows:
+api/angular.module.ng.$location $location} service. Angular is then responsible for supplying the
+instance of `$location` to the controller when the constructor is instantiated. There are two ways
+to cause controller instantiation – by configuring routes with the `$location` service, or by
+referencing the controller from the HTML template, as follows:
@@ -35,7 +34,7 @@ we have to supply this information to angular in the form of an additional prope controller constructor function called `$inject`. Think of it as annotations for JavaScript.-MyController.$inject = ['$route']; +MyController.$inject = ['$location'];The information in `$inject` is then used by the {@link api/angular.injector injector} to call the -- cgit v1.2.3