ng-class-odd

Apply CSS classes to odd-indexed elements inside ng-repeat.

Description

The ng-class-odd directive works just like ng-class, but it applies only to odd-indexed elements inside an ng-repeat block.

Must be used inside ng-repeat.

Animations

If data-animate attribute is present, the following animations will be applied to the element:

AnimationOccurs
add-classBefore the class is applied to the element
remove-classBefore the class is removed from the element

Parameters


ng-class-odd

  • Type: string | array

  • Description: An expression evaluating to a space-delimited string or array of class names.

  • Example:

    <div ng-repeat="item in items" ng-class-odd="'odd-row'"></div>
    

Demo

<section ng-app>
  <style>
    .odd-row {
      background-color: gainsboro;
    }
  </style>
  <div ng-repeat="item in [1,2,3,4]" ng-class-odd="'odd-row'">{{item}}</div>
</section>
{{item}}