@lucasdragos wrote:
I have an object with a category: type, and I need to list in my segment the items according to their type.
object: arrProduto
1. produto: 1. Type: "V " 2. idProduto: 276 3. name: "SALSAO" 2. produto: 1. Type: "F " 2. idProduto: 290 3. name: "ABOBORA"
<div padding> <ion-segment [(ngModel)]="arrProdutos"> <ion-segment-button value="F"> Fruta </ion-segment-button> <ion-segment-button value="V"> Verdura </ion-segment-button> <ion-segment-button value="L"> Legume </ion-segment-button> </ion-segment> </div> <div [ngSwitch]="arrProdutos" *ngFor="let item of arrProdutos"> <ion-list *ngSwitchCase="item.type" > <ion-card > <ion-card-content color="primary"> <ion-grid> <ion-row> <ion-col align-self-start> <h3>Produto:</h3> </ion-col> <ion-col justify-content-end> <p align="right">{{ item.name}}</p> </ion-col> </ion-row> </div>
Posts: 1
Participants: 1