dir-paginate angularJs 创建的每个 table 行的行号

row number for each table row created by dir-paginate angularJs

如何为 dir-paginate angularJs 创建的每个 table 行设置行号。 我使用了两种方式的代码,但是两种方式都有错误和设置错误。

第一种方式:

    <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>

第二种方式:

<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>

为什么我不能从函数和 ng-bind 增加 $scope.rowNum

我认为 {{$index+1}} 应该可以

带有索引 + 分页的图像 -> {{(currentPage-1)*pageSize +$index+1}}