You can do this with array containing dictionary

<div ng-repeat="item in data | orderBy : item.mykey " >
{{ (data | filter: item.myKey).length  }}
</div>

Le samedi 11 août 2012 06:09:35 UTC-4, Pawel Kozlowski a écrit :
>
> Hi! 
>
> Recently I've seen quite a number of posts here with question on how 
> to count items in a filtered list that is used in ngRepeat. 
>
> There were number of posts but most them involved either: 
> - moving filtering logic to a controller 
> - calling filters twice (I might be guilty of proposing this one!) 
> Some people went as far as counting DOM elements with jQuery. 
>
> Anyway, today it downed on me that one could use something like: 
>
> ng-repeat='item in filtered = (items | filter:filterExpr) and then 
> simply {{filtered.length}} 
>
> Seems to be working perfectly fine: 
> http://jsfiddle.net/pkozlowski_opensource/Nk8qy/2/ 
>
> What do you think? Can you spot any problem with using this syntax? 
>
> Cheers, 
> Pawel 
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to