"> " />
Easy Tutorial
❮ Ng Ng Dblclick Ng Ng Cloak ❯

AngularJS ng-class-odd Directive

AngularJS Reference Manual


AngularJS Example

Set class="striped" for odd rows in a table:

<table ng-controller="myCtrl">
  <tr ng-repeat="x in records" ng-class-odd="'striped'">
    <td>{{x.Name}}</td>
    <td>{{x.Country}}</td>
  </tr>
</table>

Definition and Usage

The ng-class-odd directive dynamically binds one or more CSS classes to an HTML element, but only for odd rows.

The ng-class-odd directive should be used in conjunction with the ng-repeat directive.

The ng-class-odd directive is recommended for styling tables, but it supports all HTML elements.


Syntax

Supported by all HTML elements.


Parameter Values

Value Description
expression Specifies one or more CSS classes.

AngularJS Reference Manual

❮ Ng Ng Dblclick Ng Ng Cloak ❯