Hi Ravi,
A working fiddle would have been nicer. I would have put in the solution in
there.
I think you need something like this:
function total(totals, item) {
totals.quantity += item.quantity;
totals.sum += item.total();
return totals;
}
$scope.$watch('cartDetails', function() {
$scope.totals = cartDetails.reduce(total, {quantity: 0, sum: 0});
}, true);
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.