**HTML Binding**
{{total() | currency: 'R$ ' : 2 }}
**Função**
$scope.total = function(){
for (var i = $scope.custos.length - 1; i >= 0; i--) {
total += $scope.custos[i].valor+total;
}
return total;
}
What is the problem with this code?
ERRO
angular.js:13920 TypeError: Cannot read property 'length' of undefined
at Scope.o.total (all.min.js:1)
at fn0 (eval at compile (angular.js:14817), <anonymous>:4:473)
at expressionInputWatch (angular.js:15946)
at Scope.$digest (angular.js:17515)
at Scope.$apply (angular.js:17790)
at done (angular.js:11831)
at completeRequest (angular.js:12033)
at XMLHttpRequest.requestLoaded (angular.js:11966)