0

I am looping over an array of objects in Angular JS. I have multiple filters applied and I am also using ngInfiniteScrolling for lazy load. Everything works fine except I can't use any sorting. Whatever orderBy I apply nothing changes at all. Here's my code:

<div infinite-scroll='loadMoreFilter()' infinite-scroll-distance='0' ng-show="showFilter">
    <div class="row" ng-repeat="product in (productsFiltered = (products | filter: { Prdha : filterBrand } | filter : { Matkl : filterCategory.categoryCode } | filter : { Pltyp : filterCatalogue } | filter : { inWishlist : filterFavorites } | filter : hideNA() )) | limitTo:totalDisplayed" ng-if="$index % 4 == 0">
    <!-- some code -->
    </div>
</div>

If I add | orderBy : myField after the last filter (before the limitTo) nothing changes, it's like the sorting is not applied. Does anyone have any idea?

Gaëtan Maisse
  • 11,587
  • 9
  • 41
  • 45
raz3r
  • 2,931
  • 6
  • 39
  • 63
  • Is there a particular reason why you have a bunch of filter expressions instead of one? Is `myField` a variable in the current scope that holds a string or a function? – a better oliver Nov 25 '15 at 17:29
  • Yeah I know that I can use a single function but the problem appears even if I use a single filter. With myField I tried pretty much everything, even a string. – raz3r Nov 26 '15 at 08:24

0 Answers0