【发布时间】:2018-06-08 07:51:33
【问题描述】:
我的 JSON 数据类似于以下代码。谁能帮我按 state 属性中的 code/desc 过滤数据。
$scope.agent =
{
"0d297c1711de":
[{
"applicationName": "rewards-accounts", "agentId": "0d297c1711de",
"status": { "agentId": "0d297c1711de", "eventTimestamp": 1510580172247, "state": { "code": 100, "desc": "Running" } }
}],
"16f279d66923":
[{
"applicationName": "rewards-accounts-details", "agentId": "16f279d66923",
"status": { "agentId": "0d297c1711de", "eventTimestamp": 1510580172247, "state": { "code": 201, "desc": "Unexpected Shutdown" } }
}],
"203b353d32ef":
[{
"applicationName": "rewards-accounts-details", "agentId": "203b353d32ef",
"status": { "agentId": "0d297c1711de", "eventTimestamp": 1510580172247, "state": { "code": 200, "desc": "Shutdown" } }
}]
};
我在 ng-repeat 中使用过这个过滤器。它不工作。 selectedCode 是我要过滤的模型数据。
| filter:{status:{ state: { code: **selectedCode**}}}
【问题讨论】:
-
你的对象是被渲染但没有被过滤,还是它没有渲染并给你
Error: [filter:notarray]?