我的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]'? –