The ngClassOdd
and ngClassEven
directives work 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
.
<ANY ng-class-odd="{expression}"> ... </ANY>
<ANY class="ng-class-odd: {expression};"> ... </ANY>
ngClassOdd – {expression} –
Expression to eval. The result of the evaluation can be a string representing space delimited class names or an array.
<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}} </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/); });