Hi guys,
At the moment, I’m retrieving data from a database to get back a list of clothing types. The data comes back in this format -
{cat1: “Womenswear”, cat2: “Dresses”, cat3: “Party”}
{cat1: “Womenswear”, cat2: “Dresses”, cat3: “Casual”}
{cat1: “Womenswear”, cat2: “Dresses”, cat3: “Formal”}
I need to populate two other dropdown fields when I get the selected value of dropdown 1. However, when the data comes back from the database, there are duplicates that I cannot seem to remove from the first dropdown (Under womenswear, there can be multiple categories)
If there any way to filter out duplicate values. Of course I’ve got the issue now where Womenswear is being shown in the dropdown around 14 times.
Here is what I’ve used for the layout, as you can see I probably need to filter out in the view and not the controller if it can be helped
<ion-item style="margin-top: 10px">
<ion-label>Category 1</ion-label>
<ion-select #productCategory1 [selectOptions]="categoryList">
<ion-option *ngFor="let category1 of categoryList; let i = index;" value="{{ i }}">{{ category1 }}</ion-option>
</ion-select>
</ion-item>