ngrepeat tracking
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.js"></script>
<div ng-app ng-controller='ctrl'>
<h3>Using $$hashKey</h3>
<div ng-repeat="task in tasks1">
<div>{{task}}</div>
<button ng-click='checkMe(task)'>Check Me</button>
</div>
<br/>
<h3>Using task.id</h3>
<div ng-repeat="task in tasks2 track by task.id">
<div>{{task}}</div>
<button ng-click='checkMe(task)'>Check Me</button>
</div>
</div>
JavaScript
function ctrl($scope) {
$scope.tasks1=[{id:1,text:"one"},{id:1,text:"two"},{id:3,text:"three"}];
$scope.tasks2=[{id:1,text:"one"},{id:2,text:"two"},{id:3,text:"three"}];
$scope.checkMe=function(item) {
console.log(JSON.stringify(item));
};
}