I am creating a dynamic table which adds a row on click(). However, every add of the row resets the value of the previous row.
<tfoot>
<tr>
<td><button type="button" (click)="addRow()">Add row </td>
</tr>
</tfoot>
// html
<tbody>
<tr *ngFor="let row of rows">
<td><input name="something" type="text" [ngModel]="row.item.name </td>
</tr>
</tbody>
// component
...
this.item = {name: 'Superman'};
this.rows = [{
item: this.item
}];
....
this.addRow() {
this.rows.push({
item: this.item
});
}