场景/问题:
child_added
)。所以它显示了第一个实时/现场新帖子,但没有显示。/feed/${this.currentUser.uid}/
方法中的console.log
表示每次都会在承诺中解析结果。但是控制器没有收到要更新_subscribeToHomeFeed
数组的数据。//路由器的解析属性
//这实际上是在ui-router resolve属性
中vm.newPosts
// HomeController相关代码
_pixData: (friendlyFire) => {
friendlyFire.showHomeFeed().then(...{
// see notes in method
// returns _pixData for home feed _pixData[1] being the latestEntryId
});
}
服务方法(friendlyFire)
.controller('HomeController', HomeController);
function HomeController(friendlyFire, _pixData) {
vm.pixData = _pixData[0];
vm.latestEntryId = _pixData[1]; // data received from the promise of showHomeFeed method
vm.newPosts = [];
friendlyFire.subscribeToHomeFeed(vm.latestEntryId).then((postData) => {
console.log(postData.key, 'post key');
console.log(postData.val(), 'post value');
var a = postData.key;
var b = postData.val();
vm.newPosts.push({'post key':a, 'post value': b});
});
}