2
Good morning!! I own a table html
and need to delete a line from it with a function typescript
(angular 2, preference)... Follows the Table Code:
<div class="col-md-12">
<div *ngIf="itens.length" class="table-responsive">
<table class="table">
<thead class="thead-dark">
<tr>
<th></th>
<th class="text-center">Código</th>
<th class="text-center">Descrição</th>
<th class="text-center">Quantidade</th>
<th class="text-center">Preço Digitado</th>
<th class="text-center">Preço Total</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of itens">
<th class="text-center">
<input type="button" value="" (click)="removerLinha(this)" />
</th>
<td class="text-center">{{item.codigoProduto}}</td>
<td class="text-center">{{haha}}</td>
<td class="text-center">{{item.Quantidade}}x</td>
<td class="text-center">{{item.PrecoDigitado | currency: 'BRL': true}}</td>
<td class="text-center"></td>
</tr>
</tbody>
</table>
</div>
</div>
You can send in your removeLine the item from the list you no longer want to display and in the removal method you splice to remove the item from the list and again call the list to update on the screen. Then when your screen is updated the data you will notice that the line that has the data of the item that was deleted will no longer appear.
– Gabriela Mendonça
Okay, thank you very much, solved my problem
– Bruno Miqueas
I detailed to you an example of me down there.
– Gabriela Mendonça