Sum of Array[index] values with Data binding


#1

Hey guys!

Say if i have an array with 2 elements in it. Each element has an id and value.

And i want to display the sum of the value of those elements.

How can I do that in Typescript and Angular 2 way ?

Can I just write it like {{element[0].value + element[1].value}} ?

Thank you.


#2

This seems like the sort of thing that is better done in a function on the TypeScript side instead of in the template.