javascript - Angular JS - How to filter a list using multiple links -


i have problem using filter function in angular js. have filter list using different links. can't understand how filter list. tried examples doesn't work. how can it?? code now:

html

<tr ng-repeat="rubric in examplerevisions | filter:myfilter" class="{{rubric.translationproposal.validations[0].class}}">     <td></td>     <td>{{rubric.translationproposal.validations[0].createdby}}</td>     <td>{{rubric.translationproposal.validations[0].createdon | date:'dd/mm/yyyy'}}</td>     <td>{{rubric.translationproposal.validations[0].action}}</td>     <td>{{rubric.action}}</td> </tr>  <a href="" ng-click="myfilter = {action: 1}">ok</a> <a href="" ng-click="myfilter = {action: 2}">new proposal</a> <a href="" ng-click="myfilter = {action: 3}">null</a> 

js

$scope.examplerevisions contains rows

json example array

{ "1":{     "id":1,     "action":1,     "translationproposal":{         "id":1,         "status":"accepted",         "createdon":1393946608751,         "createdby":12,         "validations":[             {                 "id":0,                 "action":"accept",                 "proposedalternative":"traduzione alternativa",                 "createdon":1393946608751,                 "createdby":12             }         ]     } } } 

<tr ng-repeat="rubric in examplerevisions | filter:myfilter" class="{{rubric.translationproposal.validations[0].class}}"> <td></td> <td>{{rubric.translationproposal.validations[0].createdby}}</td>     <td>{{rubric.translationproposal.validations[0].createdon | date:'dd/mm/yyyy'}}</td>     <td>{{rubric.translationproposal.validations[0].action}}</td>     <td>{{rubric.action}}</td> </tr>  <a href="" ng-click="myfilter[1].action = 1}">ok</a> <a href="" ng-click="myfilter[1].action = 2}">new proposal</a> <a href="" ng-click="myfilter[1].action = 3}">null</a> 

that should trick, if want filter object values of nodes myfilter needs root object

------edit----------

dunno why haven't noticed straight away, filter doesn't work object of objects, need array of objects, check updated version of plunker here: http://plnkr.co/edit/ejbzxqhwdrf1yopiam61?p=preview


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -