Answer the question
In order to leave comments, you need to log in
How to remove duplicate entries?
I have a table where the total amount should be displayed. But the problem is that because of this, I have these lines duplicated several times. How can I avoid this?
<table>
<thead>
<tr>
<th style="text-align: center;">Общее кол-во</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let monitoring of filteredMonitorings ">
<td style="text-align: center">{{ getTotal(filteredMonitorings) }} </td>
</tr>
</tbody>
</table>
getTotal(arr){
return arr.reduce( (sum, curr) => sum + parseFloat(curr.count),0 );
}
Answer the question
In order to leave comments, you need to log in
<tr *ngFor="let monitoring of filteredMonitorings ">
<td style="text-align: center">{{ getTotal(filteredMonitorings) }} </td>
</tr>
<tr *ngFor="let monitoring of filteredMonitorings ">
<td style="text-align: center">{{ monitoring.count }} </td>
</tr>
<tr>
<td style="text-align: center">{{ getTotal(filteredMonitorings) }} </td>
</tr>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question