使用Firebase的三向数据绑定并爱好它。虽然发生了一些奇怪的事情:
我有这个:
var fire = $firebaseObject(DatabaseRef.child('fire').child($stateParams.fireId));
fire.$bindTo($scope, "formData")
.then(function() {
fire.update($scope.formData)
.then(function(data) {
toastr.info('Updating ongoing', 'Busy');
}, function(error) {
toastr.error(error.message, error.reason);
})
})
虽然三向数据绑定有效,但更改反映在控制器,模板和firebase数据库远程中,我收到错误:
angular.js:13920 TypeError: fire.update is not a function
我在某处做错了,只是不知道在哪里。感谢。