angular-filter
angular-filter copied to clipboard
Added average filter to math module
updated readme and added tests as well.
Hi @benbakhar, take a look on this example, or see: jsbin
$scope.nums = [1,2,3,4,5,6,7,8,10];
$scope.scores = [
{ name: 'Dan', score: 80 },
{ name: 'Edd', score: 90 },
{ name: 'Edi', score: 40 },
{ name: 'Ari', score: 87 },
{ name: 'Tod', score: 99 }
];
example1:
<p>{{ (nums | sum) / nums.length }}</p>
example2: <!-- your TODO :) -->
<p>{{ ( scores | map: 'score' | sum ) / scores.length }}</p>
Thx for the PR, let me know what do you think...
Hey man, i updated the filter according your second example. make more sense this way gn :)
Hey, I think this filter would be useful rather than to add a division...
Yes, this would be a helpful addition to this already awesome library.