I'm using ngx-pipes plugin(https://github.com/danrevah/ngx-pipes#filterby) in my ANgular project. And I don't find a way to filter by multiple properties.
My data looks like this
[{'name': 'tom', 'age':12, location:'denver'},
{'name': 'jerry', 'age':11, location:'denver'},
{'name': 'scott', 'age':12, location:'denver'},
{'name': 'tiger', 'age':13, location:'colarado'},
{'name': 'lion', 'age':11, location:'denver'}]
Now, I want to use filterBy pipe to filter the data whose age is 11, and whose location is 'Denver'.
Please help me with this.
You can chain pipes.
p>{{ users | filterBy: ['age']: 11 | filterBy: ['location']: 'Denver' }}</p>
If you have a large array this may cause performance issues. This is the reason why angular 2+ do not have a filter pipe implemented. Keep this in mind. Read this for better understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With