javascript - angular ng repeat sum with group items -


i want group (country-wise) sum of grouped elements eq. ta + ta = 150. in column labeled jan. plunker http://plnkr.co/edit/wwx3vuvhmpp8xgqjgxm2?p=preview

thanks in advance...

$scope.months =  [      { "mon" : "jan", "country" : "uk", "ta" : 70, "tsr" : 5164, "tp" : 2822 , "tr" : 10771},     { "mon" : "feb", "country" : "uk", "ta" : 660, "tsr" : 6164, "tp" : 4822 , "tr" : 10771},     { "mon" : "mar", "country" : "uk", "ta" : 57, "tsr" : 1164, "tp" : 3322 , "tr" : 20771},      { "mon" : "jan", "country" : "austria", "ta" : 80, "tsr" : 5164, "tp" : 2822 , "tr" : 10771},     { "mon" : "feb", "country" : "austria", "ta" : 67, "tsr" : 6164, "tp" : 4822 , "tr" : 10771},     { "mon" : "mar", "country" : "austria", "ta" : 55, "tsr" : 1164, "tp" : 3322 , "tr" : 20771}     ]; 

my html is:

<table>   <thead>     <tr>       <td>jan</td>       <td>feb</td>       <td>mar</td>     </tr>   </thead>   <tr>     <td ng-repeat="month in months" >       <table >         <tr>           <td>{{month.ta}}</td>                                                         </tr>         <tr>           <td>{{ month.tsr }}</td>                                                        </tr>                             </table>     </td>   </tr> </table> 

i think can this

$scope.getsummofages=function(group){   var summ=0;   for(var in group.data)   {     summ=summ+number(group.data[i].age);   }   return summ; }; 

Comments