Using collection-repeat with nth-child css selector


#1

I’m attempting to use an nth-child selector in css to apply an alternating background color to ion-items that are being rendered with collection-repeat but the ion-items order in the DOM does not match the order in which they are actually rendered in our scroll container:

I’ve also tried using ngClassEven / ngClassOdd with no luck. Does anyone have any suggestions on how to get alternating background colors working with collection-repeat?


#2

ng-class="{‘assertive-bg’:$even}"