我的列表仅在手动输入变量的静态值时填充,而不是在我从forEach循环中输入时。
打字稿
this.pinnedCCollection = this.afs.collection(pinnedCollection);
this.pinnedC = this.pinnedCCollection.valueChanges().do(item => {
console.log('-------------');
item.forEach(element => {
// NOT WORKING
// this.searchedS = element.s;
// this.selectedT = element.t;
// this.selectedC = element.c;
// WORKING
this.searchedS = 'static value 1';
this.selectedT = 'static value 2';
this.selectedC = 'static value 3';
this.searchForA();
});
});
searchForA(){
var placeToSearch = 'SPlace/'+this.searchedS+'/TPlace/'+this.selectedT+'/CPlase/'+this.selectedC+'/APlace';
this.aCollection = this.afs.collection(placeToSearch);
this.a = this.aCollection.valueChanges();
}