我有一個JSON像這樣:如何在角度2中過濾對象內的對象?
filteredArray = [
{
"Key":"Brochure",
"Value":[{
"Title":"Accounting Services",
"service":"Accounting",
"Location":"",
"Industry":"Accounting",
"Reprint":"Request",
"Contact":"Mike Astrup",
"Updated":"04/15/2017",
"Owner":"EB",
"Status":"Approved",
"online":"true",
"Type":"Material",
"Url":".common/service"
},
{
"Title":"Accounting Services",
"service":"Accounting",
"Location":"",
"Industry":"",
"Reprint":"Request",
"Contact":"Mike Astrup 1",
"Updated":"04/15/2017",
"Owner":"EB",
"Status":"Approved",
"online":"true",
"Type":"Material",
"Url":".common/service"
}]
},
{
"Key":"Handout",
"Value":[{
"Title":"Accounting Services",
"service":"Accounting",
"Location":"",
"Industry":"",
"Reprint":"Request",
"Contact":"Mike Astrup 2",
"Updated":"04/15/2017",
"Owner":"EB",
"Status":"Approved",
"online":"true",
"Type":"Material",
"Url":".common/service"
},
{
"Title":"Accounting Services",
"service":"Accounting",
"Location":"",
"Industry":"",
"Reprint":"Request",
"Contact":"Mike Astrup 3",
"Updated":"04/15/2017",
"Owner":"EB",
"Status":"Approved",
"online":"true",
"Type":"Material",
"Url":".common/service"
}]
}
]
我必須要過濾的工業基地中的數據角2
我在角2使用此查詢管道,但該數據不得到過濾。
filteredArray.filter(
item => item.Value.filter(
innerItem => innerItem.Industry.match(industry)))
你是什麼意思的行業過濾器?你需要按特定行業類型進行分組嗎? –
你想實現什麼?從代碼發佈所需的輸出 –
我必須以相同格式過濾此json數據,但應根據行業過濾,即如果行業與Accounting相匹配。 –