AngularJS ng-class-even Instruction
Definition and Usage
ng-class-even
Instructions dynamically bind one or more CSS classes to HTML elements, but they only take effect when the HTML element appears every other time (even number).
ng-class-even
Instructions are only valid when associated with ng-repeat
directive is effective only when used together.
ng-class-even
Directives are very suitable for setting styles for items in a list or rows in a table, but they can be used for any HTML element.
Example
Set class="striped" for every other row (even rows) of the table row:
<table ng-controller="myCtrl"> <tr ng-repeat="x in records" ng-class-even="'striped'"> <td>{{x.Name}}</td> <td>{{x.Country}}</td> </tr> </table>
Syntax
<element ng-class-even="expression</element>
All HTML elements support.
Parameters
Parameters | Description |
---|---|
expression | Returns an expression for one or more class names. |