Angular: Empty Fiddle

http://angularjs.org/

by pkozlowski_opensource

HTML

<div ng-controller="MyCtrl">
  <table>
    <tr ng-repeat="item in items" ng-class="{class1 : $index%2==0, class2 : !($index%2==0)}">
        <td>{{item}}</td>
    </tr>
  </table>
</div>

CSS

.class1 {
    background-color : green;
}

.class2 {
    background-color : blue;
}

JavaScript

var myApp = angular.module('myApp',[]);


function MyCtrl($scope) {
    $scope.items = ['foo', 'bar', 'foobar'];
}