我有一系列对象,如下所述。
$scope.paymentArray= [
{ id: 10 ,paymentMode: 'Cash', amount:100},
{ id: 11 , paymentMode: 'Debit Card', amount:200},
{ id:12, paymentMode: 'Cash',amount: 900 },
{ id: 13, paymentMode: 'Credit Card', amount:500},
{ id:14,paymentMode: 'Cash', amount: 600 }
];
当我在此
上运行ng-repeat时<div ng-repeat ="payment in paymentArray">
<span>{{$index+1}}</span>)<span>Mode : {{payment.paymentMode}}</span><span>Amount : {{payment.amount}}</span>
</div>
I get the result as such:
1)Mode:Cash Amount:100
2)Mode:Debit Card Amount:200
3)Mode:Cash Amount:900
4)Mode:Credit Card Amount:500
5)Mode:Cash Amount:600
但我需要以相同的付款方式对数据进行分组,并以下列方式表示结果。
1)Mode:Cash Amount:100
Amount:600
Amount:900
2)Mode:Debit Card Amount:200
3)Mode:Credit Card Amount:500
请帮忙。谢谢。