New in TypeScript - Angular 2.
I am interested to know how to calculate the amount from the list.
I have already selected the necessary items and get the amount with an error:
Error type TS "void" is not assigned to type "Creance []",
creancesOfSelectedRemise: Creance[];
onSelectRemise(remise: Remise, event: any) {
...
this.creancesOfSelectedRemise = this.creances
.filter(c => c.id_remettant === remise.id_remettant)
.forEach(c => this.totalCreances += c.creance_montant);
}
It seems that "forEach" is being used incorrectly.
Can I add a filter and a forEach value at the same time?
thanks beah
source
share