javascript - 跨父母查询不返回任何数据
问题描述
我正在对 firebase-firestore 进行查询,但它没有返回我的代码的任何数据。这里是所有类别的打印位置以及您获得每个类别 ID 的位置:
<div class="categorias" >
<a mat-list-item>Categorias</a>
<a mat-list-item *ngFor="let categoria of categorias | async" routerLink="categorias/{{categoria.id}}">
<mat-icon>category</mat-icon>
<span class="sidenav-caption">{{categoria.nome}}</span>
</a>
</div>
这是我的查询,没有错误,但没有数据:
produtos: Observable<Produtos[]>;
produtosCollection: AngularFirestoreCollection<Produtos>;
constructor(
private router: Router,
private route: ActivatedRoute,
private produtoService: ProdutosService,
private afs: AngularFirestore
) { }
ngOnInit() {
const categoria = this.route.snapshot.paramMap.get('id');
this.produtosCollection = this.afs.collection('produtos', ref => {
return ref.where('categoria', '==', categoria);
});
this.produtos = this.produtosCollection.valueChanges();
}
只有标签 h1 的内容正在准备中,其余的都没有:
<h1>Test </h1>
<div *ngFor="let produto of produtos | async">
<p>{{produto.descricao}}</p>
</div>
解决方案
推荐阅读
- html - 网格布局与侧边栏重叠
- security - 如果我有某个用户的会话 ID 怎么办?
- c# - 为什么我们在对 Dictionary 值进行操作时不对引用进行操作?
- sql - H2 DB SQL,如何制作昨天日期的变量并在之后调用它
- android - 仅当单击底部菜单项并且仍使用 setupWithNavController 时,我们如何处理底部菜单导航项单击?
- c++ - std::vector 扩展参数助手
- javascript - 如何将错误(404)页面放入nuxt中的“dist”目录?
- javascript - 如何从 Bootstrap 多选返回文本值并编写 SQL
- c# - 使用 Microsoft.DwayneNeed 解决 WPF 空域问题时出错
- javascript - fn instanceof Function VS Object.prototype.toString.call(fn) === "[object Function]"