0

$scope.items = $http.get(config.base + '/humanized/angular_data').success();

I want to get data in controller and put it in $scope.items but I can't do that.

2
  • 1
    Ajax calls are asynchronous. It won't assign the data until the call returns. Also, need to see more to help. Commented Feb 23, 2014 at 13:23
  • you need to return a promise, and then get your data when that promise has been resolved. Commented Feb 23, 2014 at 13:24

1 Answer 1

2

In older versions of angular you were able to directly assign promises to $scope, which would manage the resolve process. This has been turned off in the current version, with a complete removal planned. To perform what you need, $scope.items should be assigned inside a resolved callback (eg: .success(function(results){ /* assign here */}))

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

Comments

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.