angular.module.ng.$compileProvider.directive.ng-class-odd

Description

The ng-class-odd and ng-class-even works exactly as ng-class, except it works in conjunction with ng-repeat and takes affect only on odd (even) rows.

This directive can be applied only within a scope of an ng-repeat.

Usage

as attribute
<ANY ng-class-odd="{expression}">
   ...
</ANY>
as class
<ANY class="ng-class-odd: {expression};">
   ...
</ANY>

Parameters

Example

   <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
     <li ng-repeat="name in names">
      <span ng-class-odd="'ng-format-negative'"
            ng-class-even="'ng-invalid'">
        {{name}} &nbsp; &nbsp; &nbsp;
      </span>
     </li>
   </ol>
  it('should check ng-class-odd and ng-class-even', function() {
    expect(element('.doc-example-live li:first span').prop('className')).
      toMatch(/ng-format-negative/);
    expect(element('.doc-example-live li:last span').prop('className')).
      toMatch(/ng-invalid/);
  });