我遇到一个问题,我无法从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
}
}