AngularJs和解析 [英] AngularJs and Parse

查看:130
本文介绍了AngularJs和解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试建立与AngularJs东西,并解析为后端。
我发现了一些教程,现在我有这个在我的控制器之一:

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

在我看来,我有一个NG重复,一切工作正常,但是当我试图让OBJECTID或ceatedAt我不能。

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.

我补充一下:

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

但在我看来,他们不显示,虽然当我检查XHR响应这个字段是present。

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

推荐答案

您应该能够访问OBJECTID和createdAt为obj的属性,如下所示:

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;

查看检索对象的解析JavaScript的指南部分。

这篇关于AngularJs和解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆