M
M
Mikhail Sinyakov2014-12-05 15:35:34
JavaScript
Mikhail Sinyakov, 2014-12-05 15:35:34

How to filter objects in Angular on click?

Hi, I just started learning Angular and I have this question...
there is a filtering menu that looks like this

2010 2011 2012 2013 2014 All time

and
All projects Website Mobile apps Games

initially active For all time and All projects
how to make it so that when you click on the year, only obj.year === 2010 is filtered
and then when you click on Games this year, only those with games are filtered
if(obj.tags.indexOf('games')>=0)
and vice versa.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
n0thing, 2014-12-05
@pvpshoot

That buttons were formed automatically from existing years, you can use the groupBy filter:
The same goes for the buttons for the type (games, etc.):
Then, when displaying your information, use the filters currentYear and currentType

<div ng-repeat="element in data | filter:{year:currentYear,type:currentType}">...</div>

V
Vladislav, 2014-12-05
@RGV

Must be Angular?
isotope.metafizzy.co

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question