Angular - List仅填充静态值,而不是变量

时间:2017-11-10 20:38:50

标签: angular

我的列表仅在手动输入变量的静态值时填充,而不是在我从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();
 }

0 个答案:

没有答案