【发布时间】:2016-05-26 05:56:18
【问题描述】:
我有两个 JSON 数组,$scope.data 有主要细节,我想在 UI 中显示,因为 cInstId 是来自 JSON $scope.color 的 foreign key。
两个 JSON 数组是
$scope.data = [
{
"id": 1,
"cTitle": "One",
"cInstId": 1
},
{
"id": 2,
"cTitle": "Two",
"cInstId": 2
},
{
"id": 3,
"cTitle": "Three",
"cInstId": 3
},
{
"id": 4,
"cTitle": "Four",
"cInstId": 4
},
{
"id": 5,
"cTitle": "Five",
"cInstId": 4
}
];
$scope.color = [
{
"cInstId": 1,
"cInstTitle": "Blue"
},
{
"cInstId": 2,
"cInstTitle": "Green"
},
{
"cInstId": 3,
"cInstTitle": "Red"
},
{
"cInstId": 4,
"cInstTitle": "Orange"
},
{
"cInstId": 5,
"cInstTitle": "Violet"
}
];
我的预期输出应该和图片一样
<div ng-repeat="members in data">
<!-- How to Show it in the UI -->
</div>
注意:不要在 控制器。
【问题讨论】:
-
您尝试过什么吗?向我们展示代码。
-
@ParthaSarathiGhosh 请帮助我...
标签: angularjs json foreign-keys angularjs-ng-repeat angularjs-filter