设置后的AngularFire miss字段

时间:2014-01-05 16:43:15

标签: angularjs firebase angularfire

我尝试像刷新值字段一样。但标题和正文值正确更新。

$scope.refreshTime = function(){
    $scope.time = new Date();
};

$scope.changeMessage = function(key) {
    $scope.refreshTime();
    console.log($scope.time);
    var child = $scope.messages.$child(key);

    child.$set({title: $scope.title, body: $scope.msg, time: $scope.time});
}

$scope.addMessage = function(e) {
    $scope.refreshTime();
    $scope.messages.$add({title: $scope.title, body: $scope.msg, time: $scope.time });
}

1 个答案:

答案 0 :(得分:1)

$ scope.time是一个对象。试试这个:

$scope.messages.$add({title: $scope.title, body: $scope.msg, time: $scope.time.valueOf()});