Reputation: 769
How to hide text ion-option . I want to hide or delete some text to show in ion-option. (not delete data) because I want to save for user choose it
<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>
and
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
}
}
I want
my ion-option show I want ion-option show
================== ======================
book book
pen pen
school school
local3
Upvotes: 1
Views: 575
Reputation: 44659
You can use the filter
method and store the result in another list
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');
And then use that property in your view
<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>
Upvotes: 1