如何隐藏文本离子离子2



如何隐藏文本离子选项。我想隐藏或删除一些文本以在离子选项中显示。(未删除数据)因为我想保存用户选择

<ion-select [(ngModel)]="refine" (ionChange)="optionsFn(item, i);" >
        <ion-option [value]="item"  *ngFor="let item of totalfilter ;let i = index" >
          {{item["@NAME"]}}
        </ion-option>
      </ion-select>

this.totalfilter = data.json().FACETLIST.FACET;
          for(let x of this.totalfilter) {
            if(x["@NAME"] == 'local3' || x["@NAME"] == 'Local3') {
              x["@NAME"].hide(); //// this error i have no idea to hide this text
            }
          }

我想要

my ion-option show           I want ion-option show
==================           ======================
book                         book
pen                          pen
school                       school
local3

您可以使用filter方法并将结果存储在另一个列表中

public availableOptions: Array<any>;
// ...
this.totalfilter = data.json().FACETLIST.FACET;
// The next line will remove Local3, local3, LOCAL3, and so on (just in case)
this.availableOptions = this.totalfilter.filter(option => option["@NAME"].toLowerCase() !== 'local3');

然后在您的视图中使用该属性

<ion-select [(ngModel)]="refine" (ionChange)="optionsFn(item, i);" >
    <ion-option [value]="item"  *ngFor="let item of availableOptions ;let i = index" >
       {{item["@NAME"]}}
    </ion-option>
 </ion-select>

相关内容

  • 没有找到相关文章