How to hide unused items with ngFor ionic?

前端 未结 1 1813
情深已故
情深已故 2021-01-22 23:00

im trying to hide unused items from ngFor, the problem is, i did hide it successfully but its place still exists and empty like the image below:

My ts file:

1条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-22 23:48

    Two options:

    Refactor the template into the following:

    
      
        
          
    {{c.expiry}} {{c.code}}

    Or store the filtered elements of the list in another instance member of the component:

    this.filteredCoupons = this.coupons.filter(c => c.coEmail == this.shared.customerData.email)
    
    
         
          
    {{c.expiry}} {{c.code}}

    0 讨论(0)
提交回复
热议问题