How can set row number for each table row created by dir-paginate angularJs. I use two way code but two way have incorrect and set error.
First way :
<tr dir-paginate='customer in Customers| itemsPerPage: 10'>
<td>{{rowNum=(rowNum+1)}}</td>
<td>{{customer.fName}}</td>
<td>{{customer.lName}}</td>
</tr>
<script>
(function(){
var app = angular.module('customerApp', ['angularUtils.directives.dirPagination']);
app.controller('customer', ['$scope', '$http', function($scope, $http){
$scope.rowNum = 1;
}]);
})();
</script>
Second way :
<tr dir-paginate='customer in Customers| itemsPerPage: 10'>
<td>{{getRowNum()}}</td>
<td>{{customer.fName}}</td>
<td>{{customer.lName}}</td>
</tr>
<script>
(function(){
var app = angular.module('customerApp', ['angularUtils.directives.dirPagination']);
app.controller('customer', ['$scope', '$http', function($scope, $http){
$scope.rowNum = 1;
$scope.getRowNum = function(){
return ++$scope.rowNum;
};
}]);
})();
</script>
Why i can't increment $scope.rowNum
from function and ng-bind ?
I think {{$index+1}} should work
image with index + pagination -> {{(currentPage-1)*pageSize +$index+1}}