Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 4581b79

Browse files
committed
doc(guide/controller): fix examples
1 parent 2be8847 commit 4581b79

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

docs/content/guide/dev_guide.di.using_di_controllers.ngdoc

+8-9
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@ The most common place to use dependency injection in angular applications is in
66
dev_guide.mvc.understanding_controller controllers}. Here is a simple example:
77

88
<pre>
9-
function MyController($route){
10-
// configure the route service
11-
$route.when(...);
9+
function MyController($location){
10+
// do stuff with the $location service
1211
}
13-
MyController.$inject = ['$route'];
12+
MyController.$inject = ['$location'];
1413
</pre>
1514

1615
In this example, the `MyController` constructor function takes one argument, the {@link
17-
api/angular.module.ng.$route $route} service. Angular is then responsible for supplying the instance
18-
of `$route` to the controller when the constructor is instantiated. There are two ways to cause
19-
controller instantiation – by configuring routes with the `$route` service, or by referencing the
20-
controller from the HTML template, as follows:
16+
api/angular.module.ng.$location $location} service. Angular is then responsible for supplying the
17+
instance of `$location` to the controller when the constructor is instantiated. There are two ways
18+
to cause controller instantiation – by configuring routes with the `$location` service, or by
19+
referencing the controller from the HTML template, as follows:
2120

2221
<pre>
2322
<!doctype html>
@@ -35,7 +34,7 @@ we have to supply this information to angular in the form of an additional prope
3534
controller constructor function called `$inject`. Think of it as annotations for JavaScript.
3635

3736
<pre>
38-
MyController.$inject = ['$route'];
37+
MyController.$inject = ['$location'];
3938
</pre>
4039

4140
The information in `$inject` is then used by the {@link api/angular.injector injector} to call the

0 commit comments

Comments
 (0)