I have the following UI buttons:
[Show All] [Category 1] [Category 2]
I would like to use filterBy
from ngx-pipes
(https://github.com/danrevah/ngx-pipes) to filter my data.
Usage: array | filterBy: [prop, nested.prop, ...]: search: [strict | optional]
From the docs, their example is: {{ users | filterBy: ['work.company']: 'Bar Tech' }}
Instead of 'Bar Tech' being a 'hard coded' filter, I would like to assign a variable 'currentCategory' instead - how do I do that? Do I simply replace
Bar Tech
withcurrentCategory
?How do I make the pipe update on button click? I understand I can bind a (click) event, however I am not quite sure how to update
currentCategory
though the (click) which would prompt the pipe to filter again.
In other words: Using buttons, I would like to update my displayed data based on a matching property (button's value must be in object's property)