我有这样的课程结构:
export class CarsData {
public PrimaryCars: string[];
public SecondaryCars: string[];
}
export class Cars {
public CarsInfo: Array<CarsData>;
}
如何将Forng应用于CarsInfo? 我做了如下:
*ngFor="let car of CarsInfo"
{{car.PrimaryCars}}
{{car.SecondaryCars}}
答案 0 :(得分:3)
根据您的数据,您没有嵌套数组,它只是一个内部有两个数组的对象, 所以你需要
<div *ngFor="let car of CarsInfo">
<div *ngFor="let primary of car.PrimaryCars">{{ primary }}</div>
<div *ngFor="let secondary of car.SecondaryCars">{{ secondary }}</div>
</div>
答案 1 :(得分:2)
tEvents