1

Hello I am trying to query my Mongoose DB for items using $scope.inventory = Item.query(); which works. Problem is I need to separate them based on a values on the front end of my app.

console.log($scope.inventory); returns [$promise: Promise, $resolved: false] which from the console I can drill into and find the values but I cant find a way of accessing them in my code. enter image description here

ReganPerkins
  • 1,645
  • 3
  • 17
  • 36
  • `Item.query().$promise.then(function(data){ $scope.inventory=data; })` Chain through the promise. Return value from the $resource actually gets expanded later to the same return object when the call is fulfilled, that what you see in the console, You can verify that by printing `$scope.inventory.length` it will just print `0` when you try to access it right after – PSL Jan 08 '15 at 03:34
  • Again you made my day! Thanks PSL – ReganPerkins Jan 08 '15 at 03:42

0 Answers0