0

For me, $promise.then() is not working. It's throwing the following error:

Cannot read property 'then' of undefined

Example code:

$scope.query = UserService.query();
$scope.query.$promise.then(function(data){
  console.log(data);
}); 

JSFiddle link

How can I fix this error?

1
  • what version of angularjs you are using Commented Jan 29, 2018 at 14:33

1 Answer 1

1

Using angularjs 1.6, It is working fine:

jsfiddle link

$scope.query = UserService.query();
$scope.query.$promise.then(function(data){
  console.log(data);
}); 
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.