我需要将我返回到特定组的数据合并,并根据该数据在UI中呈现该组。
"ServiceRequest": [
{"Status": "Re-Open",
},{
"Status": "Open",
},{
"Status": "Customer?agent Action Needed",
},{
"Status": "Future Review",
},{
"Status": "Closed",
},{
"Status": "Request Declined",
}{
"Status": "Closed",
},
}];
预期结果
使用Angular渲染
答案 0 :(得分:0)
您可以在ngrepeat
中尝试订购<ul>
<li ng-repeat="item in items order by 'status'">Status:{{item.Status}}</li>
</ul>
查看此link了解更多详情
答案 1 :(得分:0)
如果您没有从API获取映射,则可以在此处使用过滤器。只是介绍一个返回状态值的函数。
$scope.getStatus = getStatus;
function getStatus (status){
//here you can declare your status mapping as you mentioned above
var statuses = {
"Re-Open" : "Open",
"Closed" : "closed"
}
return statuses[status];
}
<ul>
<li ng-repeat="status in ServiceRequest">Status:{{getStatus(status)}}</li>
</ul>