Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have read through all the posts where people get this issue where $http is not a function, and it looks like for the most part it is due to injections being done in the wrong order.

My module definition looks like this:

angular.module("app", []).controller("appCtrl", ['$scope','$http',
    function ($scope, $http) {

...

    $scope.makeCall= function ($http) {
         console.log("HERE");
         $http({ method: 'GET', url: <url }).
            then(function (response) {

                console.log(response.data);
                return response.data;
            }, function (response) {

        });
    };
}
])

Any suggestions would be greatly appreciated.

share|improve this question
1  
try this $scope.makeCall= function () { ... – SSH Mar 23 at 20:35

Remove $http parameter from makeCall function, which is killing the existence of $http dependency injected over controller. Basically when you are adding it on function, it is setted as undefined

$scope.makeCall= function () { //<-- removed $http dependency from here
   console.log("HERE");
   $http({ method: 'GET', url: 'url' })
      .then(function (response) {
            console.log(response.data);
            return response.data;
      }, function (response) {

      }
   );
};
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.