I have been looking for a solution to using angulars built in filter with a different data set than that what is used for the ng-repeat but I haven't come across anything.
For example in this code snippet the filter would only be filtering data inside of filteredPages but the problem with this is that filteredPages is only the first page of paginated results, I want to filter the original 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 () {
//Define the pagination functionality....
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 I would like to filter through. $scope.filteredPages is the paginated result, so when using the filter it only searches the page that you are currently on.
ng-model search
<div class="form-group">
<input type="text" ng-disabled="check" ng-model="search" class="form-control" placeholder="Filter By">
</div>
Would I have to create my own filter or is there another way I can do it? If anyone has an idea on how I can achieve this, would be appreciated. Thank you in advance.
filteredPagesis created from. Can you show us that as well$scope.list_dataas you repeater and create a custom filter then set them up like thisng-repeat="rate in list_data | filter:search | currentPage: pageStartAndEnd | orderBy:sortType:sortReverse "Either that or add ang-changeto thesearch