首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由dir- table创建的每个表行的行号

由dir- table创建的每个表行的行号
EN

Stack Overflow用户
提问于 2016-09-02 14:38:50
回答 1查看 2.1K关注 0票数 1

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

第一种方法:

代码语言:javascript
复制
    <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>

第二种方式:

代码语言:javascript
复制
<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- $scope.rowNum中增加绑定?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-02 15:19:29

我觉得{{$index+1}}应该可以

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39285818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档