Sabarish Sankar Sabarish Sankar - 1 year ago 163
AngularJS Question

AngularJs ReferenceError: $http is not defined

I have the following angular function

$scope.updateStatus = function(user){
url: user.update_path,
method: "POST",
data: {user_id:, draft: true}

But whenever this function is called, I am getting the ReferenceError: $http is not defined in my console. Can anyone help me understand what i am doing wrong here.

Answer Source

Probably you haven't injected $http service to your controller. There are several ways of doing that.

Please read this reference about DI. Then it gets very simple:

function MyController($scope, $http) {
   // ... your code
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download