This was a known bug and fixed, so why not upgrade to v1.2.16 ?
It works as expected on v1.2.16 .
If you want to stay on v1.2.15 , you must either use the Morgan solution ( ng-class + $index ) or include only one class in ngClassOdd / ngClassEven :
<span class="shared" ng-class-odd="'odd'" ng-class-even="'even'">
BTW, in version 1.2.16 there were no changes in violation (according to changelog ), so the update should be completely transparent.
UPDATE:
For completeness, I should mention that it is possible to use the ngRepeat $even / $odd properties. For example:.
<span ng-class="$even?'shared odd':'shared even'">
<sub> Note:
Since the list of elements displayed by ngRepeat is based on 0, the first element ( $index: 0 ) is considered odd, and we (people) expect the 1st element to be considered even. So make sure you apply the classes back.
The same is true for the ngClass + $index approach. Sub>
The recommended solution is still being updated to v1.2.16 .
Just in case, there is plunkr with all 3 v1.2.15 solutions.
gkalpak May 19 '14 at 18:44 2014-05-19 18:44
source share