【发布时间】:2018-01-01 13:50:30
【问题描述】:
我有一个这样的 JSON:
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"
}]
}
]
我必须在 Angular 2 中根据工业基础过滤数据。
我在 Angular 2 的管道中使用此查询,但数据没有被过滤。
filteredArray.filter(
item => item.Value.filter(
innerItem => innerItem.Industry.match(industry)))
【问题讨论】:
-
行业过滤器是什么意思?是否需要按特定行业类型进行分组?
-
你想达到什么目的?从代码中发布所需的输出
-
我必须以相同格式过滤此 json 数据,但应根据行业过滤,即如果行业与会计匹配。