Skip to content

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