angular.module.ng.$compileProvider.directive.ngClassEven

Description

The ngClassOdd and ngClassEven works exactly as ngClass, except it works in conjunction with ngRepeat and takes affect only on odd (even) rows.

This directive can be applied only within a scope of an ngRepeat.

Usage

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

Parameters

Example

   <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
     <li ng-repeat="name in names">
      <span ng-class-odd="'odd'" ng-class-even="'even'">
        {{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(/odd/);
    expect(element('.doc-example-live li:last span').prop('className')).
      toMatch(/even/);
  });