我的JSON数据看起来像下面的代码。你可以帮助我通过代码/ desc过滤数据,这是在状态属性。针对JSON键/值嵌套对象的角度js过滤器对我无效
$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**}}}
是你的对象被渲染,但没有得到过滤,或者它不呈现nd给你'错误:[filter:notarray]'? –