I have a function in angular
which me suma
the amount that happens with the parameter, but throws me at the end of the suma
error Nan
, which can be ?, this total is plasmo in html
, I hope for your help, thanks!
In another function, I invoke the sum_total
, since in my html
I have a list with ckeck box
, then the following function selects all the records, and therefore I have that sumar
all the amounts of each one of the registers, the problem is that I print each sum and make it perfect, the problem is the last one throws the NaN
here we invoke the function sum_total
$scope.seleccionar_todo = function () {
$scope.cuentas.forEach(function (cuenta) {
cuenta.pagar = $scope.seleccionado;
$scope.sum_monto(parseFloat(cuenta.importe_total));
});
};
feature that totals all amounts
$scope.monto_total=0;
$scope.sum_monto = function (importe){
$scope.monto_total= parseInt($scope.monto_total) + parseInt(importe);
console.log(parseInt($scope.monto_total));
};
html
<h4 style="margin-left:990px; ">Monto Seleccionado: {{ monto_total }}</h4>