AngularJS using $index with ng-repeat.
HTML
<div ng-app="myApp" ng-controller="MainCtrl">
<ul>
<li ng-repeat="page in pages | unique: 'customer.id'" >
<a ng-class="{ testClass: $index == pageNumber }" ng-click="setPageNumber($index)">{{ page.id }}</a>
</li>
</ul>
</div>
CSS
.testClass {
background: black;
color: white;
}
JavaScript
var app = angular.module('myApp', []);
app.controller('MainCtrl', function($scope) {
$scope.pages = [
{ id:1, customer: { name: 'foo', id: 10 } },
{ id:2, customer: { name: 'bar', id: 20 } },
{ id:2, customer: { name: 'bar', id: 20 } },
{ id:2, customer: { name: 'bar', id: 20 } },
{ id:3, customer: { name: 'foo', id: 10 } },
{ id:4, customer: { name: 'bar', id: 20 } },
{ id:5, customer: { name: 'baz', id: 30 } },
];
$scope.pageNumber = 0;
$scope.setPageNumber = function(index) {
$scope.pageNumber = index;
}
});