Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Normally you would use ngClassOdd (<a href="http://docs.angularjs.org/api/ng.directive%3angClassOdd">http://docs.angularjs.org/api/ng.directive:ngClassOdd</a>) and ngClassEven (<a href="http://docs.angularjs.org/api/ng.directive%3angClassEven">http://docs.angularjs.org/api/ng.directive:ngClassEven</a>) directives like this:</p> <pre><code>&lt;tr ng-repeat="item in items" ng-class-odd="'class1'" ng-class-even="'class2'"&gt; </code></pre> <p>Here is the jsFiddle: <a href="http://jsfiddle.net/pkozlowski_opensource/hNHJ4/1/">http://jsfiddle.net/pkozlowski_opensource/hNHJ4/1/</a></p> <p>Unfortunately there is an issue where the mentioned directives are not working correctly when rows are removed: <a href="https://github.com/angular/angular.js/issues/1076">https://github.com/angular/angular.js/issues/1076</a></p> <p>As a work around you can use the ngClass directive (<a href="http://docs.angularjs.org/api/ng.directive%3angClass">http://docs.angularjs.org/api/ng.directive:ngClass</a>) with the $index variable exposed by a repeater:</p> <pre><code>&lt;tr ng-repeat="item in items" ng-class="{class1 : $index%2==0, class2 : !($index%2==0)}"&gt; </code></pre> <p>Here is the jsFiddle: <a href="http://jsfiddle.net/pkozlowski_opensource/am7xs/">http://jsfiddle.net/pkozlowski_opensource/am7xs/</a></p> <p>It is not super-clean, but could be improved (for example, by exposing a function in a root scope, something like:</p> <pre><code>ng-class="getClass($index,'class1','class2')" </code></pre> <p>till the mentioned bug is fixed</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload