Skip to content
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

Added average filter to math module #36

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Added average filter to math module #36

wants to merge 9 commits into from

Conversation

benbakhar
Copy link

updated readme and added tests as well.

@a8m
Copy link
Owner

a8m commented Oct 13, 2014

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...

@benbakhar
Copy link
Author

Hey man,
i updated the filter according your second example. make more sense this way gn :)

@Adriien-M
Copy link
Contributor

Hey,
I think this filter would be useful rather than to add a division...

@Delapouite
Copy link

Yes, this would be a helpful addition to this already awesome library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants