Angular, "x is not a function" when attempting to use Service

Viewed 10616
app.service('situacao', function($log, $q, $http, $rootScope){
    var situacao = this; 
    situacao.lista = {};
    situacao.getAllSituacao = function(){
        var defer = $q.defer();
        console.log("php/getAll.php");
        $http.get($rootScope.endPoint + "php/getAll.php")
            .success(function(res) {
            console.log(res);
            situacao.lista = res;
            defer.resolve(res);
        }).error(function(err, status){
            defer.reject(err);
        }); 
        return defer.promise;
    };
    return situacao;});
    app.controller('listCtrl',['$scope', '$uibModal', '$log', '$http', function(situacao, $scope, $modal, $log, $http) {   
    $scope.init = function(){
        $scope.getAll();
    }
    $scope.getAll = function(){        
        situacao.getAllSituacao().then(function(res){
            //sucess
            $scope.dispSituacao = situacao.lista;  
        }, function(err){
            //error
        })
    };
    $scope.init(); 
}]);

I'm trying to use the "service" but results in error: situacao.getAllSituacao is not a function.

what is wrong?

2 Answers
Related