how can set row number each table row created dir-paginate angularjs. use 2 way code 2 way have incorrect , 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 can't increment $scope.rownum
function , ng-bind ?
Comments
Post a Comment