将FirebaseDataSnapshot转换为JS对象

时间:2016-04-09 16:17:48

标签: firebase angular

pushROOMS对象放入我的.on("child_added", ....)数组Player,如下所示。该对象的一个​​部分是其他对象的数组(id obj,它具有一些属性,如nameROOMS.players等等。如何分配给snap.child("players").val(),因为EXCEPTION: Error trying to diff '[object Object]'不起作用(snap.child("players").val()-rooms -id -name -isRoomFull +board -players -kEFvdfeff84fdfdff -id -name -kEFvd4545dfjh9fvv -id -name getRooms() { this.roomsRef.on("child_added", function(snap) { ROOMS.push({ id: snap.child("id").val(), name: snap.child("name").val(), players: [], //how to assign to this property isRoomFull: snap.child("isRoomFull").val(), board: snap.child("board").val(), }) }); 结构如下所示:

var lmp = 5,
    lma = 0;
  $(window).scroll(function() {

    if ($(document).height() - 50 <= $(window).scrollTop() + $(window).height()) {
      $('.div').append('<div></div><div></div><div></div><div></div><div></div>');
      lmp++;
      lma++;
      console.log(lmp + " : " + lma);
    }
  });

1 个答案:

答案 0 :(得分:0)

我会尝试这样的事情:

WRITE_EXTERNAL_STORAGE

有关详细信息,请参阅此问题: