새로운 각도 2. 나는 Json 파일을 가져올 수 있습니다. 일부 json 파일을 얻을 수 있지만 json 파일 안의 배열은 가져올 수 없습니다. 예를 들어, 두 번째 UL의 첫 번째 UL 및 IMU 장치에서 GPS 장치를 시각화하고 싶습니다. 그들이 배열되어 있더라도 목록 둘 모두에 IMU 장치의 동일한 데이터가 나타납니다.각도 2 ngFor for 중첩 된 json
JSON 파일
"config" : [
{
"id" : "gps_device",
"name" : "GPS Device",
"type" : "String",
"widget" : "dropdown",
"fields" : [ "Disabled", "XSensIMU", "GenesysADMA"],
"default" : "Disabled"
},
{
"id" : "imu_device",
"name" : "IMU Device",
"type" : "String",
"widget" : "dropdown",
"fields" : [ "Disabled1", "XSensIMU1", "GenesysADMA1"],
"default" : "XSensIMU"
}
]
//here I should get loop of GPS device array
<h1>Gps Device</h1>
<ul *ngFor="let drop of config[0]">
<li *ngFor="let sub of drop.fields"> {{sub}}</li>
<ul>
//here array of IMU device
<h1>IMU Device</h1>
<ul *ngFOr="let drop1 of config[1]">
<li *ngFOr="let sub1 of drop.fields"> {{sub1}}</li>
<ul>
문제는 무엇입니까? –
두 목록을 보여 드리고 싶습니다. 데이터는 json 파일에서 가져온 것입니다. 첫 번째 목록 데이터는 config [0] .fields이고 두 번째 목록 데이터는 config [1] .fields입니다. –
'let sub1 of drop1.fields "' – echonax