2

I wanted to try to build something with AngularJs and Parse as the back end. I found some tutorials now I have this in one of my controllers:

 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);
    }

in my view I have a ng-repeat and everything works fine, but when I try to get the objectId or the ceatedAt I can't.

I add:

      $scope.sessions = results.map(function(obj) {
        return {points: obj.get("points"), gameDate: obj.get("gameDate"),  gameId: obj.get("objectId"), createdAt: obj.get("createAt"), parseObject: obj};

But in my view they are not displayed, although when I check the XHR responses this fields are present.

1 Answer 1

1

You should be able to access the objectId and createdAt as properties of obj, as follows:

var objectId = obj.id;
var updatedAt = obj.updatedAt;
var createdAt = obj.createdAt;

See the Retrieving Objects section of the Parse JavaScript Guide.

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

1 Comment

Yes I looked around and found this. Thank you!

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.