是否有任何选项可以根据成员 ID 从另一个列表中获取成员名称到表中?
(function(){
var app = angular.module('tableApp',[]);
app.controller('tableController', function($scope){
$scope.users = [
{ id: 2, name: 'member2'},
{ id: 5, name: 'member5'},
{ id: 1, name: 'member1'},
{ id: 4, name: 'member4'},
{ id: 3, name: 'member3'}
];
$scope.items = [
{ product: 'Lorem ipsum', date: '12-March-2013', rate: 12.35, member: 1, status: 'approved' },
{ product: 'dolor sit', date: '1-January-2011', rate: 60.54, member: 3, status: 'pending'},
{ product: 'adipisicing', date: '14-November-2014', rate: 0.99, member: 1, status: 'approved'},
{ product: 'do eiusmod', date: '2-November-2014', rate: 4.00, member: 2, status: 'approved'},
{ product: 'culpa qui', date: '1-November-2014', rate: 34.05, member: 1, status: 'pending'},
{ product: 'mollit anim', date: '3-November-2014', rate: 45.00, member: 4, status: 'approved'}
];
});
})();
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div class="container" ng-app="tableApp">
<table class="table table-striped table-hover" ng-controller="tableController">
<thead>
<tr>
<th>Date</th>
<th>Amount</th>
<th>Member</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in items ">
<td>{{item.product}}</td>
<td>{{item.date}}</td>
<td>{{users[item.member-1].name}}</td>
</tr>
</tbody>
</table>
</div>