Hi Jaymes!
On Thu, Aug 30, 2012 at 7:09 AM, Jaymes Bearden <
slas...@gmail.com> wrote:
> I've been looking over a few of these solutions over the past few days and
> it basically boils down to a memory vs time situation (isn't it always? :)
Yeh, it is vary often memory vs. cpu trade-off. I saw also some
DOM-intensive solutions for this counting problem and it was pretty
bad.
> It would be nice if the devs could expose some information about the
> ng-repeat back to the controller somehow...
>
> Something like: <div ng-repeat="item in items | filter:blah"
> ng-repeat-results="repeatResults"> ... </div>
but this is exactly what my little trick:
ng-repeat='item in filtered = (items | filter:filterExpr)'
does, no? It should expose a filtered array in the 'filtered' variable
(not in a controller but in scope thought, so it is imediatelly
available to a template).
> I feel that running the filter set twice is ugly in the view and having a
> duplicated / filtered array of the results sucks for memory usage in large
> data sets.
Exactly, this is why you can see this assignment to a temp variable so
you don't need to run filters twice (at least not for counting
objects). Do you see filters running multiple times (apart from the
standard $digest cycles)?
Cheers,
Pawel