Another way of solving this, extending from Vaclav's answer to solve this particular calculation — i.e. a calculation on each row.
.filter('total', function () {
return function (input, property) {
var i = input instanceof Array ? input.length : 0;
if (typeof property === 'undefined' || i === 0) {
return i;
} else if (typeof property === 'function') {
var total = 0;
while (i--)
total += property(input[i]);
return total;
} else if (isNaN(input[0][property])) {
throw 'filter total can count only numeric values';
} else {
var total = 0;
while (i--)
total += input[i][property];
return total;
}
};
})
To do this with a calculation, just add a calculation function to your scope, e.g.
$scope.calcItemTotal = function(v) { return v.price*v.quantity; };
You would use {{ datas|total:calcItemTotal|currency }}
in your HTML code. This has the advantage of not being called for every digest, because it uses filters, and can be used for simple or complex totals.