Is there a way to assign row numbers to each table row generated by dir-paginate in AngularJS? I've tried two methods but encountered errors with both.
First approach :
<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 approach :
<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 am I encountering issues when trying to increment $scope.rowNum
using ng-bind and a function?