@RobertLow wrote:
Hi, I am trying to display 2 ion-card at the same time. This is what I tried,
Page1.html
<span *ngFor="let temp of myArray"> <div *ngIf="temp.myArray === 'red' || temp.myArray === 'blue' || temp.myArray === 'green'"> <ion-card> <ion-card-content>Color</ion-card-content> </ion-card> </div> <div *ngIf="temp.myArray === '1' || temp.myArray === '2' || temp.myArray === '3'"> <ion-card> <ion-card-content>Number</ion-card-content> </ion-card> </div> </span>
Page1.ts
myArray: Array<myArray> = ["red", "2"]; ionViewDidEnter() { for(let i=0; i<this.myArray.length;i++){ if(this.myArray[i] === "red" || this.myArray[i] === "blue" || this.myArray[i] === "green") { console.log("color"); } else if(this.myArray[i] === "1" || this.myArray[i] === "2" || this.myArray[i] === "3") { console.log("number"); } else{} }
Thankyou for the help
Posts: 1
Participants: 1