I have three product details and I have the total price at the bottom. If user changes the quantity of one item, then the total price should be updated.
I have
<div>
<p class="desc">{{item.desc}}</p>
<p class="price">{{item.price}}</p>
<p class="qty"><input type="text" maxlength="2" ng-model="item.qty"></p>
</div>
<div>
<p class="desc">{{item.desc}}</p>
<p class="price">{{item.price}}</p>
<p class="qty"><input type="text" maxlength="2" ng-model="item.qty"></p>
</div>
<div>
<p class="desc">{{item.desc}}</p>
<p class="price">{{item.price}}</p>
<p class="qty"><input type="text" maxlength="2" ng-model="item.qty"></p>
</div>
Total Price: $XXXX.XX
I get the above divs using loop.
When user changes the quantity in any of the three, then I need to update the total price and display below.
Suppose:
DIV1 has price $10 qty 1
DIV2 has price $20 qty 1
DIV3 has price $30 qty 1
The total is $60
If user changes the quantity of DIV2 to 3, then I need to get the total as $100
How do I do this in AngularJS?
item. Try showing your scopes in more realistic example, this will help us answer.