Trying to calculate a total payOffs.amount (payOffs is a FormArray). Not sure how to do it properly so the total would observe changes to current and new for amounts. Here i
I added a function:
// calculate a sum of all payoffs
sumPayOffs() {
return this.myModel.payOffs.reduce((sum, val) => sum + val.amount, 0);
}
and in HTML (just before "Add Pay Off" button) I added readonly number field, displaying the sum:
I changed pay offs field type from text to number, so inserted into mode value will be numeric.
Updated plunker: http://plnkr.co/edit/Q5HYcpnPQosSYvk2KkoP?p=preview