1991macl 1991macl - 1 year ago 154
AngularJS Question

Filter list generated with ng-repeat by md-tabs

next question (sorry, I really try to code, but at the moment I don't understand everything).

I have a list with checkboxes which is generated with ng-repeat.
Above I have a tab navigation which I want to use as a filter.

I tried something like this (in many variations) but it doesn't work:

<span ng-repeat="item in items | filter: item.category: cat.category">

My exceptation is that on tab Category1, only bullhorn, car and star are shown, Category2 only euro, eye and facebook and tab Category3 only fax, feed and film are shown.

Now there are all items from the scope, not filtered after category.

Heres a plnkr example with my code: https://plnkr.co/edit/iCQRwH4XRr3DKQcQG329

Many thanks in advance!

Answer Source

What you want is to filter your Array with the cat Object, so you just add the Object witch you want to use to filter (look at the Docmentation > expression > Object):

<span ng-repeat="item in items | filter: cat.category">

Working Plunker

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download