如何为dir-paginate创建的每个表行设置行号。我使用双向代码,但两种方式都有错误和设置错误。
第一种方法:
<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- $scope.rowNum中增加绑定?
发布于 2016-09-02 15:19:29
我觉得{{$index+1}}应该可以
带索引的图片+分页-> {{(currentPage-1)*pageSize +$index+1}}

https://stackoverflow.com/questions/39285818
复制相似问题