Reputation: 10464
Lets say I have multiple filters in my ng-repeat
like so:
input.search(ng-model="filter", placeholder="Search...")
ul.list
li(ng-if="things.length === 0") It looks like we don't have any things.
li(ng-repeat="thing in things | orderBy:'name' | filter: search")
span {{ thing.name }}
Right now, if I initially have no things
, then I receive the message saying so. But if I filter by something which yields no results, it does not display the message, which I understand.
My question is, how do you implement a multi-filter ng-repeat
and display a message when the collection or filter yields no results?
I was messing with this example to no avail. My attempt:
thing in filteredThings = thing | orderBy: 'name' | filter: search
Upvotes: 1
Views: 557
Reputation: 104805
You were close, syntax was a little off:
(ng-repeat="thing in filteredThings = (things | orderBy:'name' | filter: search"))
li(ng-if="filteredThings.length === 0") It looks like we don't have any things.
Upvotes: 2