Html 试图在表中以角度显示数组中的数据

Html 试图在表中以角度显示数组中的数据,html,angular,Html,Angular,我在Angular 6中有一些显示数据的代码,但是我尝试实现的代码不起作用?到目前为止,我的代码是: TS文件 incident = [ {id: 'E200', product: 'MP2355 Black and white', floor: '2', address: '11 Rue', code: '75019'}, ]; incidents = this.incident[0]; <tr class="" *ngFor="let state of inc

我在Angular 6中有一些显示数据的代码,但是我尝试实现的代码不起作用?到目前为止,我的代码是:

TS文件

  incident = [ 
    {id: 'E200', product: 'MP2355 Black and white', floor: '2', address: '11 Rue', code: '75019'},
  ];

  incidents = this.incident[0];
<tr class="" *ngFor="let state of incidents">
    <td>{{state.id}}</td>
</tr>
HTML文件

  incident = [ 
    {id: 'E200', product: 'MP2355 Black and white', floor: '2', address: '11 Rue', code: '75019'},
  ];

  incidents = this.incident[0];
<tr class="" *ngFor="let state of incidents">
    <td>{{state.id}}</td>
</tr>

{{state.id}

这不应该只是偶发事件而不是偶发事件吗

<tr class="" *ngFor="let state of incident">
    <td>{{state.id}}</td>
</tr>

{{state.id}

这不应该只是偶发事件而不是偶发事件吗

<tr class="" *ngFor="let state of incident">
    <td>{{state.id}}</td>
</tr>

{{state.id}
您只从数组中获取一个对象,因此它无法在视图中迭代循环

this.incidents=this.incident;
<tr *ngFor= "let incident of incidents">
<td>{{ incident.id }} </td>
..
..
</tr>
this.incidents=this.incident;
{{incident.id}
..
..
您只从数组中获取一个对象,因此它无法在视图中迭代循环

this.incidents=this.incident;
<tr *ngFor= "let incident of incidents">
<td>{{ incident.id }} </td>
..
..
</tr>
this.incidents=this.incident;
{{incident.id}
..
..

id
似乎不是
事件
对象上的属性。
事件=this.incident[0]我不明白这个,或者示例的其余部分。示例数据中没有
id
键。请更新您的问题。抱歉,输入错误,id是序列号。
id
似乎不是您的
incents
对象上的属性。
incents=this.incentent[0]我不明白这个,或者示例的其余部分。示例数据中没有
id
键。请更新您的问题。对不起,输入错误,id是序列号。