From 313d7956e47cb514c720544e15353f30d3f1ff9f Mon Sep 17 00:00:00 2001 From: Brian Feister Date: Tue, 30 Sep 2014 13:38:10 -0400 Subject: [PATCH] docs(minerr/unpr): note that ctrls cant depend on other ctrls --- docs/content/error/$injector/unpr.ngdoc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/content/error/$injector/unpr.ngdoc b/docs/content/error/$injector/unpr.ngdoc index ade8b3d1..f4ceaef9 100644 --- a/docs/content/error/$injector/unpr.ngdoc +++ b/docs/content/error/$injector/unpr.ngdoc @@ -54,4 +54,18 @@ angular.module('myModule') .directive('myDirective', ['myCoolService', function (myCoolService) { // This directive definition does not throw unknown provider. }]); -``` \ No newline at end of file +``` + + +Attempting to inject one controller into another will also throw an `Unknown provider` error: + +``` +angular.module('myModule', []) + .controller('MyFirstController', function() { /* ... */ }); + .controller('MySecondController', ['MyFirstController', function(MyFirstController) { + // This controller throws an unknown provider error because + // MyFirstController cannot be injected. + }]); +``` + +Use the `$controller` service if you want to instantiate controllers yourself.