2

The raw results returned from Parse.com are shown in the console as [child, child].

I imagine this means that there are three levels to this object? So in order to access in the first ng-repeat do I need to do a foreach in the controller before pushing to an array and then use that in $scope... seems a long way around to get what i want.

Is it possible to use the raw results from Parse.com in the scope. I would like to do this:

var query = new Parse.Query("Programme");
query.equalTo("userId", userId);
query.find()
.then(function(result){
        $scope.programmes = result;
        console.log($scope.programmes);
});

However this gives me the child elements - do I have to foreach, or is there some angular trickery?

2
  • What's wrong with $scope.programmes = result;? You can use it like this too.
    – dfsq
    Commented Mar 15, 2015 at 20:31
  • I then have to use 3 x ng-repeats to access the data
    – Taylorsuk
    Commented Mar 15, 2015 at 20:33

2 Answers 2

2

You are able to perform Parse.Object's get function within the view.

So I changed things to be

{{programme.get('title')}}

Credit for this is from here

1

The marked answer is not working any more The proper way is to extend the object and then map the values back to whatever items you need in that class. Then you can bind in normally to ng-repeat without changing your html code specifically for Parse.

var Game = Parse.Object.extend("Game"); 
var query = new Parse.Query(Game);
query.find({
success: function(results) {
  $scope.$apply(function() {
  $scope.games = results.map(function(obj) {
    return {points: obj.get("points"), gameDate: obj.get("gameDate"),  parseObject: obj};
  });
});
},

error: function(error) {
  console.log(error);
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.