【发布时间】:2016-11-01 16:45:36
【问题描述】:
我正在尝试检索具有特定键的参数的所有项目。
这是用检索到的项目填充数组的函数:
this.subscription = this.activatedRoute.params.subscribe(
(param: any) => {
let postId = param['id'];
console.log(postId);
this.postsService.subscribePostReplies(postId)
.do(console.log)
.subscribe(posts => { this.posts = posts; this.cdr.detectChanges(); });
});
这是服务中的方法:
subscribePostReplies(postKey: string) {
return this.af.database.list('posts', {
query: {
orderByChild: 'repliedTo',
equalTo: postKey
}
});
}
问题是查询发生时页面刷新,我还收到以下警报: FIREBASE 警告:使用未指定的索引。考虑将 /posts 中的 ".indexOn": "repliedTo" 添加到您的安全规则中以获得更好的性能
【问题讨论】:
标签: angular angularfire2