I am using a angularjs filter method on an repeated array of items and trying to filter numbers with a limitTo filter.
This is my JsFiddle code
The filter is working fine but I have a condition ng-if="!o.IsFeaturedEvent" and filter should apply to the event list which is not IsFeaturedEvent. Currently it is applying on all the events
How can I use limitto with ng-if condition
Any suggestion or help would be appreciated.
Thanks in advance
You need to create a custom filter like this:
And apply it before your limit to, like this:
The
nonFeaturedEventfilter will remove all featured events before passing to thelimitTofilter.Here's a link to the fiddle for this idea. It's a bit of a simplification.