I would like to change an image when I click on a button.
I made this:
home.html
<div class="card"> <img [src]="cards.img" /> </div> <ion-button (click)="logEvent($event)"> <ion-icon slot="icon-only" name="checkmark-outline"></ion-icon> </ion-button> </ion-content>
and my home.ts
export class HomePage implements OnInit {
cards;
constructor() {
this.cards = [];
}
ngOnInit() {}
logEvent(event) {
console.log("click");
this.cards = [
{
img: "https://placeimg.com/300/300/people",
},
{
img: "https://placeimg.com/300/300/animals",
},
];
}
}
but that's as far as I can go.