【发布时间】:2015-08-03 17:56:45
【问题描述】:
我的要求略有不同,请您在标记为重复之前仔细阅读。 举个例子:
<table ng:init="stuff={items:[{description:'gadget', cost:99,date:'jan3'},{description:'thing', cost:101,date:'july6'},{description:'thing', cost:101,date:'jan3'} ]}">
<tr>
<th>Description</th>
<th>Cost</th>
</tr>
<tr ng:repeat="item in stuff.items|filter"> /*only filtered item grouped by date*/
<td>{{item.description}}</td>
<td ng-bind='item.cost'>{{item.cost}}</td>
</tr>
<tr>
<td></td>
<td>{{total}}</td> /*cost of items grouped by date jan3*/
</tr>
</table>
我如何计算按项目分组的总成本?是否有任何角度数据属性,我可以在其中添加分组项目的成本,然后再次为下一个分组项目重新初始化它?
【问题讨论】:
标签: javascript angularjs angularjs-ng-repeat ng-repeat angularjs-filter