1

I'm using Parse.com for my backend and following the basic tutorial on the Parse documents. I've set a controller and can't display all the rows from the database table named Events. How would I fix the code to display all rows from the table?

.controller('sllc',['$scope',function($scope){   


var Events = Parse.Object.extend("Events");
var query = new Parse.Query(Events);

query.find({
  success: function(results) {
    console.log(results); 
    $scope.items = results.Array;  

  },
  error: function(error) {
    alert("Error: " + error.code + " " + error.message);
  }
});
}])

1 Answer 1

0

After looking over some sample code, I was able to solve this question. I had to apply an extra function and return the values individually.

.controller('sllc',['$scope',function($scope){   


var Events = Parse.Object.extend("Events");
var query = new Parse.Query(Events);

query.find({
  success: function(results) {

    $scope.$apply(function() {
       $scope.items = results.map(function(obj) {  

           return { 
             objectId: obj.id, 
             author: obj.get("author").id,  
             eventname: obj.get("eventname"), 
             eventDescription: obj.get("eventDescription"), 

           };
       });
    });

  },
  error: function(error) {
    alert("Error: " + error.code + " " + error.message);
  }
});
}])
Sign up to request clarification or add additional context in comments.

1 Comment

When i do it this way, i get $digest already in progress error, any idea why? And without $apply i get this problem: stackoverflow.com/questions/34365658/…

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.