I was looking for a solution to use the angles built into the filter with a different dataset than the one used for ng-repeat, but I did not find anything.
For example, in this code snippet, the filter will filter the data only internally filteredPages
, but the problem is that filteredPages
- this is only the first page paginated, I want to filter the source data that filteredPages
is created from.
<tr ng-repeat="rate in filteredPages | filter:search | orderBy:sortType:sortReverse ">
<td data-title="'location'">{{rate.location}}</td>
<td data-title="'code'">{{rate.code}}</td>
<td data-title="'peak_charge'">{{rate.charge_peak}}</td>
<td data-title="'offpeak_charge'">{{rate.charge_offpeak}}</td>
<td data-title="'connnection_charge'"> {{rate.connection_charge}}</td>
</tr>
filteredPages
$scope.$watch('currentPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
var end = begin + $scope.numPerPage;
$scope.filteredPages = $scope.list_data.slice(begin, end);
return $scope.filteredPages;
});
$scope.list_data
is the data that I would like to filter. $scope.filteredPages
- This is a paginated result, so when you use a filter, it only searches on the page on which you are currently located.
ng-model search
<div class="form-group">
<input type="text" ng-disabled="check" ng-model="search" class="form-control" placeholder="Filter By">
</div>
, ?
- , , . .