【发布时间】:2017-10-06 02:18:40
【问题描述】:
以这个 JSON 为例:
{
"TableRows": [
{
"Name": "Lord of the Rnis",
"Length": "2:40"
}
],
"Category": "Fantasy"
}
进入这些类:
export interface IMovies{
Category: string;
TableRows: ITableRows[];
}
export interface ITableRows{
Name: string;
Length: string;
}
以下 ngFor 逻辑效果很好,但这不是我想要循环的:
<tr *ngFor="let row of rows">
<td>{{row.Category}}</td>
<td>{{row.TableRows[0].Name}}</td>
<td></td>
</tr>
这个逻辑不起作用:
<tr *ngFor="let row of rows.TableRows">
<td>{{row.Name}}</td>
<td>{{row.Length}}<td>
</tr>
我在这里做错了什么?
【问题讨论】:
-
什么是行?数组或 Imovies?还是一个 ITableRows 数组??
标签: angular