Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I implement ng-class-odd in Aurelia

Tags:

aurelia

I would like the odd table rows to bee colored. Angular has ng-class-odd and ng-class-even that works inside the scope of ng-repeat.

Can I somehow get the index of the repeat-for function in Aurelia?

like image 548
Martin Andersen Avatar asked Nov 17 '25 18:11

Martin Andersen


1 Answers

There is $even and $odd properties that is available on the items in an repeat.for binding.

You could conditionally apply a class like this -

<ul>
  <li repeat.for="item of items" class="${ $even ? 'my-class': '' }"></li>
</ul>
like image 193
PW Kad Avatar answered Nov 20 '25 16:11

PW Kad