How to solve this error correctly?

3
Error: [$injector:unpr] http://errors.angularjs.org/1.4.5/$injector/unpr?p0=%24scopeProvider%20%3C-%20%24scope%20%3C-%20LogUserService
at Error (native)
at http://localhost:8080/web/resources/js/angular/angular.min.js:6:416
at http://localhost:8080/web/resources/js/angular/angular.min.js:40:307
at Object.d [as get] (http://localhost:8080/web/resources/js/angular/angular.min.js:38:308)
at http://localhost:8080/web/resources/js/angular/angular.min.js:40:381
at d (http://localhost:8080/web/resources/js/angular/angular.min.js:38:308)
at e (http://localhost:8080/web/resources/js/angular/angular.min.js:39:64)
at Object.g.instantiate (http://localhost:8080/web/resources/js/angular/angular.min.js:39:213)
at Object.<anonymous> (http://localhost:8080/web/resources/js/angular/angular.min.js:39:501)
at Object.e [as invoke] (http://localhost:8080/web/resources/js/angular/angular.min.js:39:96)
    
asked by anonymous 14.10.2015 / 16:43

2 answers

3

A good tip is always to access the links that the angular generates when it points out that an error has occurred.

For example link $ injector / unpr? p0 =% 24scopeProvider% 20% 3C-% 20% 24scope% 20% 3C-% 20LogUserService

The angular itself is already telling you the problem and still giving you the answer when you access the link.

  

Unknown provider: $ scopeProvider

14.10.2015 / 17:11
2

You are trying to use $scope , but the function that defines your controller or similar is not referencing $scope to injection. Something similar to this:

angular.module('myApp', [])
.controller('MyController', [function () {
    $scope.varContent = true; // Erro: $scope está faltando
}]);

Pass the reference, like this:

angular.module('myApp', [])
.controller('MyController', ['$scope', function ($scope) {
  // Do something with myService
}]);
    
14.10.2015 / 17:05