我試圖讓ngRepeat的我這裏有之,我想這樣做的HTML文件有反正我可以存儲總和爲它增加總結在angularjs
<div class = "row" ng-repeat= "product in products">
<div class = "col"><input type="checkbox" name="check" value="{{product.product_id}}"></div>
<div class = "col">{{product.product_name}}</div>
<div class = "col"><input type="text" ng-model="quantity"></div>
<div class = "col">{{product.price * quantity}}</div>
</div>
<div class = "row" align="center">
<div class="col">
<strong>Total : {{total}}</strong>
</div>
你想總結什麼?你可以編輯你的問題,並給予更多的清晰度?你想要ngRepeast的意思是你想要多少產品的總數,或者你想要所有產品的總成本{產品價格*數量}? – Naitik
與http://stackoverflow.com/questions/22731145/calculating-sum-of-repeated-elements-in-angularjs-ng-repeat(與答案) – Keugels
數量完全相同的問題應該是產品特定的。用ng-model =「product.quantity」替換ng-model =「quantity」 – John