我想查询的子集合中AngularFire2与没有成功公司的FireStore。已搜索,但没有找到合适的解决方案如何查询AngularFire2/FireStore中的子集合?
ngOnInit() {
// this does work
this.africaCollection = this.afs.collection('Country', ref => ref
.where('code', '==', 'za'));
this.countriesAfrica = this.africaCollection.valueChanges();
// this does not work
this.townCollection = this.afs.collection('Country').doc('za')
.collection('Towns');
this.towns = this.townCollection.valueChanges();
{
我的HTML看起来像这样:
<div>
<table>
<tr *ngFor="let town of towns | async">
<td>{{ town.name }}</td>
</tr>
</table>
</div>
我在这一个新手。
你能用stackblitz.com重现问题?我可以帮助很多更用一个例子(我AngularFire的作者) –
大卫嗨 - 拥有使用stackblitz困难,但我已经把我在github上https://github.com/JacquesSchalkwyk/Firestore-Qry尝试。我希望这将有所帮助。目前我的数据库有默认的规则,每个人都可以读写。结构是Country-Towns-Listings –
当我将规则设置为:-service cloud.firestore match/databases/{database}/documents {0} {0} }} } 时 –