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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.