There are "N" inputs in a formgroup that need to be summed:
<input (keyup)="sum($event)" type="text" name="estoque_variacao{{i}}" class="form-control" id="estoque_variacao{{i}}" formControlName="estoque_variacao">
This is the Typescript code:
sum(value){
let sum;
if(sum == null){
sum = 0;
}
sum = +Number(value.key);
}
When pressing "22", only "2" is obtained:
2.
Attempts have been made with this code:
sum += parseFloat(valor.key);
However, the same response is received.
How can this be achieved?
Something like this is needed, but in Angular/Typescript: