2016-07-21 3 views

답변

0

unit.cars으로 당신은 캔트 액세스를 units_feed.json app.component.html는

<ul *ngFor="let unit of units"> 
    <li> 
    {{unit.details.count}} // getting data OK result -> 5642 
    </li> 
    <li> 
    {{unit.cars.vehicle_id}} // not getting data 
    </li> 
</ul> 

객체의 배열입니다. vehicle_id이있는 객체 중 하나에 액세스하려는 경우 {{unit.cars[0].vehicle_id}}을 사용할 수 있습니다. [0]에 배열의 첫 번째 항목에 액세스하라는 메시지가 표시되고 해당 속성 vehicle_id을 볼 수 있습니다.

는이

<ul *ngFor="let unit of units"> 
    <li> 
    {{unit.details.count}} 
    </li> 
    <li *ngFor="let car of unit.cars">{{car.vehicle_id}}</li> 
</ul> 
+0

처럼 뭔가를해야 겠죠시겠습니까 대단히 감사합니다 잘 설명했다. – Jason

관련 문제