0

What's the secret to accessing the angular.js $http object?

function MyController($scope) {
  $http... // not defined
}

1 Answer 1

2

You should inject it:

function MyController($scope, $http) {
   $http... // now is defined
}

More on dependency injection docs.

Sign up to request clarification or add additional context in comments.

1 Comment

Huh, wish the docs on $http had told me it had to be injected... thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.