【发布时间】:2021-08-16 22:06:21
【问题描述】:
我在用 HTML 创建动态表格时遇到了一个奇怪的问题。
我希望用户能够在表中创建新条目,在这种情况下我称他们为人员。
每个人都是PersonInfo类型的接口。
interface PersonInfo {
showOtherData: boolean;
person: Person;
}
interface Person {
name: string;
age: number;
}
我有很多人。每次添加一个新人,就意味着 HTML 表格中多了一个新行。
我创建我的表:
<table>
<tbody>
然后我想遍历不同的人来显示不同的数据单元:
<td>
<input [(ngModel)]="person.person.name" class="center form-control" type="text"
placeholder="Name" data-toggle="tooltip" title="Person's name" />
</td>
【问题讨论】:
标签: html angular typescript html-table