Angular Firestore查询无法获取文档ID

时间:2019-08-05 20:34:00

标签: javascript angular google-cloud-firestore angularfire2

im在我的有角度的web应用程序中查询数据,如下所示:

this.notesCollection = this.afs.collection('BasicBlogs', ref =>{
    return ref.where('title','==', blog)
  });
  this.notes = this.notesCollection.valueChanges()

这是我的笔记:

interface Note{
imageUrl: string;
title: string;
body: string;
titledesc: string;
imgalt: string;
imgdesc: string;
imgtitle: string;
authorId: string;
state: string;

}

现在的问题是我无法访问每个通过查询参数的文档的文档ID。因此,我尝试了以下操作,但没有成功:

 this.notesCollection = this.afs.collection('BasicBlogs', ref =>{
  return ref.where('title','==', blog)
 });
  this.notes = this.notesCollection.valueChanges()
  this.id = this.notesCollection.valueChanges.id

0 个答案:

没有答案