3

I am using ng-repeat to show all items in an result set. I have a custom search box which filters out results via a custom filter. I now need to add pagination, but I also need all the items in the result set to be searchable, regardless of pagination. Here is the code:

<div 
ng-repeat=
"items in obj | filter : {ownerId: controller.ownerId}
 | customSearchFilter : controller.searchText as filteredResults | limitTo: controller.paginationLimit
"></div>

According to the ng-repeat documentation: https://docs.angularjs.org/api/ng/directive/ngRepeat, It seems that the "as" micro-syntax can only be used at the end. limitTo of course has to be after the filter in order for items to be searchable. Anyone had this issue before?

efsnick
  • 91
  • 8

1 Answers1

3

The answer found in the link below allowed me to keep my alias and achieve the desired result.

https://stackoverflow.com/a/11722324/1520950

Community
  • 1
  • 1
efsnick
  • 91
  • 8
  • If I `console.log filteredItems` I always get the data one filter later. It's not the result of the just changed filter, but the one from the previous change. Didn't you have this problem? – Anna May 17 '17 at 08:54