I want to display on my html what should be the image based from my if statement.
On my Typescript:
styleArray = ["Solitary", "Visual","Auditory","Logical","Physical","Social","Verbal",];
constructor(){
for(var i=0; i <= this.styleArray.length -1 ; i++){
if (this.arrayTest[0].style == this.styleArray[i]){
this.styles = [
{ src: './assets/img/'+ this.styleArray[i] + '.png',
button: this.styleArray[i] + 'InstructionPage()'},
];
console.log("First: " + this.styleArray[i]);
}
}
}
On my HTML:
<ion-row>
<ion-col width-25 >
<ion-card class="card-5 full">
<img class="list" src="{{this.styles.src}}" (click)="{{this.styles.button}}" />
</ion-card>
</ion-col>
</ion-row>
For example:
I got is “Solitary” , it should display the image and its button on my view.
I’m having an error which is “src” & “button” undefined. - What am I doing wrong?