I am trying to provide a pagination to a table:  

Let's say there are `100` records and **records per page** is `10`. If I am in 3rd page, records from `21` to `30` should be prepared in the table.

So I am trying to filter those records using `angular filter` but couldn't succeed. 
I tried multiple ways:

1. `<tr on-last-repeat ng-repeat="record in data | filter:( $index>= fromRow && $index <= toRow)" role="row">`
2. Created a custom filter but unable to pass either `$index` or record to the `filter`. If record could be passed to the filter, so that I can get the index by `records.indexOf(record)`.

Trying to pass `$index`:

```
<tr on-last-repeat ng-repeat="record in data | paging:$index:fromRow:toRow track by $index" role="row">

```

I found a solution in `StackOverflow` which is named as native filter:

```
<tr on-last-repeat ng-repeat="record in data | filter:filterPaging()" role="row">

$scope.filterPaging = function(){
    return function(record){
        var idx = $scope.data.indexOf(record)+1;
        if(idx >= $scope.fromRow && idx <= $scope.toRow) return true;
        return false;
    }
};

```

But this function is getting called so many times. My table has 4 columns and 10 records and the function is being called for 40 times. I am concerning about performance if there are thousands of records.

Can somebody please take few minutes to have a look on this.