Ich möchte auf Seite HTML aktualisieren, wenn Sie Zeile in der Tabelle entfernen klicken. Ich habe den Code von AngularJs 2.0 verwendet, aber nicht auf Seite html aktualisiert. Bitte hilf mir.Vielen Dank!Zeile entfernen alle in Tabelle verwenden angular2
Shipping.Component.html
`<div class="example table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Giá trị đơn hàng</th>
<th>Giá ship</th>
<th>Xóa</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let row of shipping.shipping_config; let i=index">
<td>
<input type="number" class="form-control fromgtdonhang gtdonhang" [(ngModel)]="row.from" placeholder="Từ">
<input type="number" class="form-control gtdonhang" [(ngModel)]="row.to" placeholder="Đến">
</td>
<td>
<input type="number" class="form-control" [(ngModel)]="row.shipping_fee" placeholder="Giá ship">
</td>
<td class="formatremove">
<a href="javascript:void(0)" (click)="removeKhunggia(i)">
<i class="icon wb-close" aria-hidden="true"></i></a>
</td>
</tr>
<tr>
<td colspan="3" class="formatbuttonadd">
<button type="button" (click)="addKhunggia()" class="btn btn-outline btn-primary">
<i class="icon wb-plus" aria-hidden="true"></i> Thêm
</button>
</td>
</tr>
</tbody>
</table>
</div>`
In Shipping.component.ts:
`ngOnInit() {
this.shippingService.getShopingConfig().subscribe(res => {
this.shipping = res;
this.rowsShippingConfig = res.shipping_config;
});
}
removeKhunggia(id: number) {
this.rowsShippingConfig.slice(id,-1);
}`
Vielen Dank! –