无法检索$ firebaseObject的数字val

时间:2015-11-11 17:24:54

标签: angularjs firebase angularfire

我遇到一个问题,我无法从AngularFire中的$firebaseObject检索数字值。

如果我console.log($scope.slideGen)该值正确显示在整个对象的日志输出中,但是如果我 console.log($scope.slideGen.time)然后我得到undefined

在控制器中获得以下代码

Auth.$onAuth(function(authData) {
      $scope.userKey = authData.uid;
      $scope.ref = Ref.child('users').child($scope.userKey);
      loadSlide();
    });

function loadSlide() {
      if ($scope.slideKey !== '') {

        $scope.slide = $firebaseObject($scope.ref.child('slides').child($scope.slideKey));

        $scope.slideGen = $firebaseObject($scope.ref.child('slidesGeneral').child($scope.slideKey));
        $scope.time = new Date(1970, 0, 1, 0, 0, 0).setSeconds($scope.slideGen.time);
        console.log('Current time set to: ' + $scope.slideGen.time); //This returns undefined
      }
    }

0 个答案:

没有答案
相关问题