mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 15:40:22 +00:00
Errors I've documented so far: - `$injector:cdep` - `$injector:itkn` - `$injector:modulerr` - `$injector:nomod` - `$injector:pget` - `$injector:unpr` - `ng:areq` - `ng:cpi` - `ng:cpws` - `ngModel:noass` Closes #3430
26 lines
No EOL
712 B
Text
26 lines
No EOL
712 B
Text
@ngdoc error
|
|
@name $injector:unpr
|
|
@fullName Unknown Provider
|
|
@description
|
|
|
|
This error results from the `$injector` being unable to resolve a required
|
|
dependency. To fix this, make sure the dependency is defined and spelled
|
|
correctly. For example:
|
|
|
|
```
|
|
angular.module('myApp', [])
|
|
.controller('myCtrl', ['myService', function (myService) {
|
|
// Do something with myService
|
|
}]);
|
|
```
|
|
|
|
This code will fail with `$injector:unpr` if `myService` is not defined. Making
|
|
sure each dependency is defined will fix the problem.
|
|
|
|
```
|
|
angular.module('myApp', [])
|
|
.service('myService', function () { /* ... */ })
|
|
.controller('myCtrl', ['myService', function (myService) {
|
|
// Do something with myService
|
|
}]);
|
|
``` |