AngularJS ng-class-even and ng-class-odd example

AngularJS directives ng-class-even and ng-class-odd work like ng-class except that when these are used with ng-repeat, these apply to even and odd rows.

.even {color: red;}
.odd {color: blue;}

<div ng-app="myApp" ng-controller='MyCtrl'>
  <ol ng-init="arr=['One', 'Two', 'Three', 'Four']">
  <li ng-repeat="val in arr" ng-class-even="'even'" ng-class-odd="'odd'">

<script src="//"></script>
  var module = angular.module('myApp', []);
  module.controller('MyCtrl', function($scope) {});
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments