Using ng-repeat we dispaly elements of array of object.$odd is true at odd position then odd class is apply to odd elements and even class will apply to other elements.

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> <style> .odd { color: red; } .even { color: green; } </style> </head> <body ng-app="switchExample"> <div ng-controller="ExampleController"> <div class="container"> <table> <thead> <tr ng-repeat="Arr in Arrs"> <th ng-class="{true:'odd',false:'even'}[$odd]"> {{}} </th> </tr> </thead> </table> </div> </div> <script> var app = angular.module("switchExample", []); app.controller('ExampleController', ['$scope', function ($scope) { $scope.Arrs = [{ name: "Angular" }, { name: "Jquery" }, { name: "JavaScript" }, { name: "Bootstrap" }] }]); </script> </body> </html>