Iterate two arrays in *ngFor— IONIC2/Angular2

前端 未结 5 1273
遥遥无期
遥遥无期 2020-12-30 13:30

I have stored values in two arrays to iterate in a single ion-list . Billerstatusstate and Billerstatusnamelst are the two arrays.

I have tried the foll

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 14:11

    Why instead of doing this

    
    
      {{bil}} 
    
    
    

    don't you create a single array in your code:

    // I'm assuming they both have the same size
    for (var _i = 0; _i < Billerstatusstate.length; _i++) {
        this.singleArray.push({
                             stat: this.Billerstatusstate[_i],
                             bil: this.Billerstatusnamelst[_i] 
                            });
    }
    

    And then in your page:

    
    
      {{item.bil}} 
    
    
    

提交回复
热议问题