I would like to get the values of an input in each row and get the sum of these rows.
my HTML:
<ng-container formArrayName="cap_values">
<tbody *ngFor="let item of capValues.controls; let i=index" [formGroupName]="i">
<tr>
<td class="freeze-first-col"><input type="text" (blur)="getName(item.value.name)" formControlName="name"></td>
<td><input type="number" formControlName="fdnTotalShares"</td>
</tr>
</tbody>
</ng-container>
my .ts:
ngOnInit() {
this.form = this.fb.group({
cap_values: this.fb.array([this.fb.group({
name: '',
fdnTotalShares: '',
}
)])
})
}
How do I iterate over each value in the array and sum it? I have seen .valueChanges but am not entirely sure how to use it.
(keyup.enter)function after keying in the value