ng-class-even
Apply CSS classes to even-indexed elements inside
ng-repeat.Description
The ng-class-even directive works just like ng-class, but it
applies only to even-indexed elements in 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-even
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-even="'even-row'"></div>
Demo
<section ng-app>
<style>
.even-row {
background-color: gainsboro;
}
</style>
<div ng-repeat="item in [1,2,3,4]" ng-class-even="'even-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.