How to obtain previous item in ng-repeat?
I have a template in which I want to generate some HTML only if the current item has some different fields from the previous item. How can I access the previous item in an ng-repeat? Arun P Johny You can do something like <div ng-app="test-app" ng-controller="MyController"> <ul id="contents"> <li ng-repeat="content in contents"> <div class="title">{{$index}} - {{content.title}} - {{contents[$index - 1]}}</div> </li> </ul> </div> JS var app = angular.module('test-app', []); app.controller('MyController', function($scope){ $scope.contents=[{ title: 'First' }, { title: 'Second' }, { title: 'Third