我有一个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相匹配。 –