我想查詢的子集合中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} }} } 時 –