2

Can you help me find a way to display the length of filtered data, exactly like in this question, but using collection-repeat.

The alias way doesn't seem to work:

<div>{{filtered.length}}</div>
<ion-item collection-repeat="item in prodataSelect | orderBy:sort | filter:search | filter: selectBrand.brand | filter: selectName as filtered"  item-width="98%" item-height="75">

nor this way:

<div>{{filtered.length}}</div>
<ion-item collection-repeat="item in filtered =( prodataSelect | orderBy:sort | filter:search | filter: selectBrand.brand | filter: selectName )"  item-width="98%" item-height="75">

Thanks

Community
  • 1
  • 1
Louis
  • 2,548
  • 10
  • 63
  • 120
  • what you are trying to do won't work conceptually with the way that `collection-repeat` operates. `collection-repeat` only renders the exact number of items that can fit on the display, which means internally there is a secondary filter. the only way that this could possibly work would be if you pre-filtered the data in your controller, but that doesn't fit with the inline filters you have here. I would say you are better off forking the `collection-repeat` directive and rewriting it for your purpose. – Claies Nov 03 '15 at 11:40
  • ok thanks for your comment. That's bad news for me. I like the flexibility of not doing the filtering in the controller... so I don't know – Louis Nov 03 '15 at 19:35
  • Good news, it is working. and then {{filteredVacatures.length}} – Giovanni Jul 04 '16 at 07:28

1 Answers1

0

This is the way it's suppose to be working:

<ion-item class="next_no_padding" collection-repeat="item in (filteredItems = (items | unique: 'Id' | orderBy: ['-id', currentSortFilter]))">

And then somewhere on the same page:

{{filteredItems.length}}

Goodluck

Giovanni
  • 400
  • 1
  • 5
  • 22