Hello, I have a form with a radio button, if "Input" is chosen, the form corresponding to the name "Value Output" is disabled and vice versa. I have a function that calculates the sum of the value of the input and output of an element and returns the result, however, when I show in the HTML it returns: NaN:
Follow function:
$scope.getTotal = function(){
var t = 0;
var s = 0;
var total = 0;
for(i = 0; i < $scope.contatos.length; i++)
{
s = s + parseFloat($scope.contatos[i].valor);
t = t + parseFloat($scope.contatos[i].valorsaida) * -1;
total = t + s;
}
return total;
}
My html calling function:
Saldo: R${{getTotal()}}
My template:
var mongoose = require('mongoose');
module.exports = function() {
var schema = mongoose.Schema({
nome: {
type: String,
required: true
},
valor: {
type: Number,
required: false
},
valorsaida:{
type: Number,
required: false
}
Can someone give me a light?