-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add sum on array #191
Comments
I think this might work: |
Thanks! Works like charm ;) |
@toddbranch I have another question with your permission. My data is array of arrays like this:
My final goal is to sum the second number of each array, for this data I know that I need to do I started with the
Here is my poor result in a bin: http://jsbin.com/laheho/edit?html,js Thanks! |
Hi @moshfeu. Here's a solution:
If there's a way to make an angular expression that accesses the second element of the array, this would be a bit simpler. But I can't figure out if that's possible. |
Thanks! I got this from the docs but I hoped that this is can be done by expression. Pretty annoying. Thank you any way. I really appreciate it! |
This should looks like:
controller
$scope.users = [ { user: { score: 988790 } }, { user: { score: 123414 } }, { user: { score: 987621 } } ];
view
<p> {{ users | sum: 'user.score' }}</p>
result
<p>2099825</p>
Similar to
min
filterThanks
The text was updated successfully, but these errors were encountered: