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:
| Animation | Occurs |
|---|---|
add-class | Before the class is applied to the element |
remove-class | Before the class is removed from the element |
Parameters
ng-class-odd
Type:
string | arrayDescription: 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}}
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.