File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
docs/content/error/$injector Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments