How to change background color of ion item of every other item?


Im trying using an ion-list and inside, ion-items that are generated by ngFor. Im trying to style every other ion-itm using

ion-item:nth-child(2n + 1) {
–background: red !important;

but its making all the ion items background red… what is going on?

I search on google and found a few methods but none worked for me:

None of these work…

IIRC ionic 3 had a class for the ion-list, that was simple to do. Seems in ionic 5 there is not.

Found a solution, it should be alot simpler but it works. Here it is for just in case anyone else has this issue.