I have a list of clickable ion-cards and I’d like to put the same effect of when a button is clicked to the cards. How can I achieve this? thank you.
Not really, at least in any easy way. Cards are not meant to be clickable/tappable really, but contain buttons instead.
I see. ion-card can listen to click events so I thought it was possible somehow.
Thank you for the tip.
although it’s like 9yrs later, i just did it with one line of code.
<ion-card *cdkVirtualFor=“let item of items(); let index = index”
+ button
class=“item”
[class.selected]=“item.selected”
>
“should / shouldn’t” is a political decision, “can / how” is a technical question.
i’m solving the techinical problem here, not to inteferer with the political decision.
Good find. Adding the button attribute to ion-card applies the same ripple and active states as a button, making the card feel tappable without extra styling. Simple and effective solution.