angularjs中所有列的总和 [英] Sum of all the column in angularjs
问题描述
< table class =table table-hover table-responsive>
< thead class =bg-primary>
< tr>
< th> Sl。否LT; /第>
< th>名称< / th>
< th>年龄< / th>
< th> Salary< / th>
< / tr>
< / thead>
< tbody>
< tr ng-repeat =雇员在emp |过滤器:MyData>
< td> {{$ index + 1}}< / td>
< td> { {employee.Name}}< / td>
< td> {{employee.Age}}< / td>
< td> {{employee.Salary}}< / td> ;
< / tr>
< tr>
< td>所有TotalTotal< / td>
< td> n个雇员的总年龄< / td>
< td> n名员工的总薪资< / td>
< / tr>
< / tbody>
< / table> ;
================= =============
这是我的表...最后我想要所有员工年龄和工资的总数...
i也在我的表中使用了过滤器...
所以总计应该在运行时以及过滤时间内工作...
这里MyData是过滤器参数....
任何人都可以告诉如何获得实际输出
Sl。没有名字年龄工资
1 aa 20 15000
2 bb 25 25000
总计45 40000 >
应该使用过滤器....
什么我试过了:
我没有得到逻辑..plz帮助任何人......
index + 1}}< / td>
< td> {{employee.Name}}< / td>
< td> {{employee.Age}}< / td>
< td> {{employee.Salary}}< / td>
< / tr>
< tr>
< td>所有TotalTotal< / td>
< td> n名员工的总年龄< / td>
< td> n名员工的总薪资< / td>
< / tr>
< / tbody>
< / table>
======================= =======
这是我的表...最后我想要所有员工年龄和薪水的总数...
i也用过滤器我的表...
所以总计应该在运行时以及过滤时间内工作...
这里MyData是过滤器参数....
任何人都可以告诉我们如何获得实际输出
Sl。没有名字年龄工资
1 aa 20 15000
2 bb 25 25000
总计45 40000 >
应该使用过滤器....
什么我试过了:
我没有得到逻辑..plz帮助任何人......
< blockquote>参考这个 Angular Filter Total - JSFiddle [ ^ ]
<table class="table table-hover table-responsive "> <thead class="bg-primary"> <tr> <th>Sl. No</th> <th >Name</th> <th>Age</th> <th>Salary</th> </tr> </thead> <tbody> <tr ng-repeat="employee in emp | filter:MyData> <td>{{$index+1}}</td> <td>{{employee.Name}}</td> <td>{{employee.Age}}</td> <td>{{employee.Salary}}</td> </tr> <tr> <td>All TotalTotal</td> <td>Total Age of n employees</td> <td>Total Salary of n employees</td> </tr> </tbody> </table>
==============================
This is my table ...at the end i want all totals of all employee age and salary...
i also used filter in my table ...
so total should work in runtime and as well as in the time of filter...
Here MyData is the filter Parameter ....
Can any one tell how to get the actual output
Sl. No Name Age Salary
1 aa 20 15000
2 bb 25 25000
Total 45 40000
It should work with filter ....
What I have tried:
I'm no getting the logic..plz help any one....
index+1}}</td> <td>{{employee.Name}}</td> <td>{{employee.Age}}</td> <td>{{employee.Salary}}</td> </tr> <tr> <td>All TotalTotal</td> <td>Total Age of n employees</td> <td>Total Salary of n employees</td> </tr> </tbody> </table>
==============================
This is my table ...at the end i want all totals of all employee age and salary...
i also used filter in my table ...
so total should work in runtime and as well as in the time of filter...
Here MyData is the filter Parameter ....
Can any one tell how to get the actual output
Sl. No Name Age Salary
1 aa 20 15000
2 bb 25 25000
Total 45 40000
It should work with filter ....
What I have tried:
I'm no getting the logic..plz help any one....
refer this Angular Filter Total - JSFiddle[^]
这篇关于angularjs中所有列的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!