我有两个需要使用 Angular cli 6.0 嵌套的 json
我是角度新手,所以我需要帮助..
json 1
[{"Name": "Fields1",
"DFields":["Fields1_1","Fields1_2"]
},
{"Name": "Fields2",
"DFields":["Fields2_1"]
}]
json 2
[
{"Id": "1", "Fields1_1": 1 , "Fields1_2": 1, "Fields2_1: 1},
{"Id": "2", "Fields1_1": 1 , "Fields1_2": 0, "Fields2_1: 1}
{"Id": "3", "Fields1_1": 1 , "Fields1_2": 1, "Fields2_1: null}
]
循环遍历字段并计算其相应数据的更快方法是什么..哪个计数不应该为空或零..
样本应该返回一个数组..
Fields1_1 = 3
Fields1_2 = 2
Fields2_1 = 2
请注意,这些字段是动态的,可以根据 json 进行更改