My JSON object contains a list of products
[
{
"id": 22565423428,
"title": "SV 8GB USB Flash Memory E100",
"imageUrl": "/images/22565423428.png",
"url": "/products/22565423428",
"prices": [
{
"amount": 159.92,
"currency": "SEK"
}
]
},
{
"id": 22565423394,
"title": "Litware Wireless Mouse M35",
"imageUrl": "/images/22565423394.png",
"url": "/products/22565423394",
"prices": [
{
"amount": 239.6,
"currency": "SEK"
}
]
}
]
Below is my ng-repeat code for iterating through the products
<ul>
<li class="basket-item" ng-repeat="product in products">
<div class="product-item-image">
<img src={{product.imageUrl}} />
</div>
<div class="product-item-description">
<h2><a href="product.html">{{product.title}}</a></h2>
<a href="#">Description</a>
</div>
<div class="product-item-qtn">
<input type="number" name=quantity ng-model="quantity" ng-init="quantity = 0"> st
<p><b>quantiy</b>1-3</p>
</div>
<p class="product-item-price">x {{product.prices[0].amount}} {{product.prices[0].currency}}</p>
<p class="product-item-total" >{{product.prices[0].amount * quantity}}</p>
</li>
</ul>
The total amount changes when users modify the quantity.
I am looking for a way to dynamically calculate and display the total amount across all products
<span>{{totalAmount}}</span>