angular 2在表中动态添加带有文本框的新列

时间:2019-01-10 10:25:13

标签: html angular typescript html-table

我有这张桌子:

<table class="table table-striped">
<thead>
    <tr>
        <td *ngFor="let col of columns">{{col.descr}}</td>
    </tr>
</thead>
<tbody>
    <tr *ngFor="let row of rows">
        <td *ngFor="let col of columns">
            <input type="checkbox" [(ngModel)]=row[col.name] (ngModelChange)="changeCheck($event)"/>
            {{row[col.name]}}
        </td>
    </tr>
</tbody>
</table>

<div>
    <button mat-raised-button (click)="addColumn()"> Add column </button>
</div>

我需要添加一列,输入数据并保存。

如何使用html和打字稿插入新列?

0 个答案:

没有答案