在 angularFire 示例中,它展示了如何从 firebase 获取对象集合。
app.controller('ctrl', ['$scope', '$timeout', 'angularFireCollection',
function($scope, $timeout, angularFireCollection) {
var url = 'https://ex.firebaseio.com/stuff';
$scope.col = angularFireCollection(url);
}
]);
只有一个对象呢?
我试过这样的事情:
fb.child('stuff/'+id).on('value', function(snapshot) {
$scope.obj = snapshot.val();
console.log('hey got the value')
console.log(snapshot.val())
});
似乎不起作用。控制台正确输出对象值,但控制器不更新。