From 8a647887d81e4e91524be99447f288b39d2d4afe Mon Sep 17 00:00:00 2001 From: Ahmed Aderopo Alejo Date: Wed, 11 Feb 2015 00:09:16 -0200 Subject: [PATCH] Updating for personal newbie error. I got an error leading me to this doc via the link below from the log exception https://docs.angularjs.org/error/$injector/unpr?p0=$scopeProvider%20%3C-%20$scope%20%3C-%20NoteService and it was still difficult to figure out the cause. I later(it took me hours) discovered that i mistakenly registered my controller as a service. --- docs/content/error/$injector/unpr.ngdoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/content/error/$injector/unpr.ngdoc b/docs/content/error/$injector/unpr.ngdoc index 7a0d828f08c9..46d9fad89867 100644 --- a/docs/content/error/$injector/unpr.ngdoc +++ b/docs/content/error/$injector/unpr.ngdoc @@ -69,3 +69,16 @@ angular.module('myModule', []) ``` Use the `$controller` service if you want to instantiate controllers yourself. + +Attempting to inject a scope object anything that´s not a controller or a directive, +for example a service, will also throw an `Unknown provider` error: +or mistakenly registering your controller as a service( believe me, it happens) an expecting +a scope injection. + +``` +angular.module('myModule', []) + .service('MyController', ['$scope', function($scope) { + // This controller throws an unknown provider error because + // a scope object cannot be injected into a service. + }]); +```