0

I'm curious if it's possible to have multiple filters on an ng-repeat inline using logical operators as opposed to writing a customfilter. ie:

<tr class="first" ng-repeat="item in events  | filter : {date: showdate} || {isWeekend: 'yes'}"  ng-show="showAllEvents == 'true'"  data-date="{{item.date | convertDate}}"></tr>

So the expected result would display items equal to showdate or if isWeekend == yes

1 Answer 1

1

You can't do or-filters inline, you'd have to write a custom filter function for that.

As for and-filters you can do it by chaining the filters, one after the other:

<tr ng-repeat="item in events | filter: {date: showdate} | filter: {isWeekend: 'yes'}"></tr>

This would repeat for every item which has a date of showdate and is a weekend.

Note: This is also equivalent to the slightly shorter filter: {date: showdate, isWeekend: 'yes'}

Sign up to request clarification or add additional context in comments.

1 Comment

Got it. Had a feeling. I tried doing this and saw it worked, but not with an or operator. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.