0

I want to implement search & pagination as easily as possible using default angular features as Angular 1.4 now has begin parameter in limitTo filter.

Desired functionality :

  • Search from all items in array
  • implement pagination using limitTo filter

Issue : if we add begin in limitTo i.e. limitTo : 5 : 2 the search functionality breaks.

here's a plnkr http://plnkr.co/Lk2TfkMoZKVbj4MH4U0G

how can we make search work while using begin in limitTo filter.

js_coder
  • 9
  • 2
  • It does work. Its just that you dont have any results to show when you say that start with 2 and limit to 5. Check this updated plunkr http://plnkr.co/edit/1B5gxKvPDwvOflQV5efq?p=preview – Nirav Gandhi Jul 09 '15 at 05:51
  • @NiravGandhi `limitTo:2:5` means show from index 2 to 7 in ng-repeat right? this works fine without search. If we remove begin, we can search from all items in array but can't at all search if we add a begin number. – js_coder Jul 09 '15 at 06:39
  • If we search House which is at index 4, it should show up right? but it doesn't. maybe I'm making some stupid mistake.. – js_coder Jul 09 '15 at 06:45
  • yo .. as per your code.. it first searches and then puts limit logic. Your search for house gets 1 result but since u do limitTo : 5 : 2, it gets lost. – Nirav Gandhi Jul 09 '15 at 10:45
  • @NiravGandhi ok great – js_coder Jul 10 '15 at 06:40

0 Answers0