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

Commit 313d795

Browse files
Brian Feisterbtford
Brian Feister
authored andcommitted
docs(minerr/unpr): note that ctrls cant depend on other ctrls
1 parent b9479ee commit 313d795

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/content/error/$injector/unpr.ngdoc

+15-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,18 @@ angular.module('myModule')
5454
.directive('myDirective', ['myCoolService', function (myCoolService) {
5555
// This directive definition does not throw unknown provider.
5656
}]);
57-
```
57+
```
58+
59+
60+
Attempting to inject one controller into another will also throw an `Unknown provider` error:
61+
62+
```
63+
angular.module('myModule', [])
64+
.controller('MyFirstController', function() { /* ... */ });
65+
.controller('MySecondController', ['MyFirstController', function(MyFirstController) {
66+
// This controller throws an unknown provider error because
67+
// MyFirstController cannot be injected.
68+
}]);
69+
```
70+
71+
Use the `$controller` service if you want to instantiate controllers yourself.

0 commit comments

Comments
 (0)