Reputation: 99
I add this into my <li>
(line 5) but it returned blank.
| filter: {tabs.tabId: currentTab}
My app demo at http://jsfiddle.net/8Ub6n/8/
my html
<ul ng-repeat="friend in user">
<li ng-repeat="relation in friend.relationship">{{relation.name}} ({{relation.points}}points)</li>
</ul>
here is my js
$scope.user = [{
'uId': 1,
'name': 'Joe',
'relationship': [{
'uId': 2,
'name': 'Jeremy',
'tabs': [{
'tabId': 1
}],
'tasks': [{
'name': 'Im Jeremy Lin'
}],
'points': 50
},{
'uId': 2,
'name': 'Michael',
'tabs': [{
'tabId': 1
}],
'tasks': [{
'name': 'Im Jeremy Lin'
}],
'points': 80
}]
}]
})
have no idea what's wrong..
Upvotes: 0
Views: 69
Reputation: 14417
Done:
Just need to make another function in scope:
$scope.isTab = function (relation) {
return relation.tab.tabId == $scope.currentTab;
}
then add to the filter:
relation in friend.relationship | filter : isTab
Upvotes: 1