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

Commit a9e02de

Browse files
ahmedalejopkozlowski-opensource
authored andcommittedFeb 21, 2015
docs(minerr/unpr): provide more info on $scope injection errors
Closes #11030
1 parent 0a8e113 commit a9e02de

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

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

+12
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,15 @@ angular.module('myModule', [])
6969
```
7070

7171
Use the `$controller` service if you want to instantiate controllers yourself.
72+
73+
Attempting to inject a scope object into anything that's not a controller or a directive,
74+
for example a service, will also throw an `Unknown provider: $scopeProvider <- $scope` error.
75+
This might happen if one mistakenly registers a controller as a service, ex.:
76+
77+
```
78+
angular.module('myModule', [])
79+
.service('MyController', ['$scope', function($scope) {
80+
// This controller throws an unknown provider error because
81+
// a scope object cannot be injected into a service.
82+
}]);
83+
```

0 commit comments

Comments
 (0)