I am using angular datatables https://l-lin.github.io/angular-datatables and noticed that the ng-repeat is done twice. I noticed it with the following directive.
<tr ng-repeat="order in vm.orders track by order.id" repeatlogger>
app.directive('repeatlogger', function() {
return function (scope, element, attrs) {
console.log(scope.$index);
}
I am using the Angular way, see HTML tab at https://l-lin.github.io/angular-datatables/#/angularWay
<table datatable="ng" class="row-border hover">
<thead>
<tr>
<th>ID</th>
<th>FirstName</th>
<th>LastName</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in vm.persons | limitTo: 50" repeatlogger>
<td>{{ person.ID }}</td>
<td>{{ person.Firstname }}</td>
<td>{{ person.Lastname }}</td>
</tr>
</tbody>
</table>
Using a ng-repeat on a div shows that it iterates once over the collection.
Which reasons exist, that angular-datatables iterates twice over the collection?