1
Hello, I have a form with a radio button, if the option "Input" is chosen the form corresponding to the name "Output Value" is disabled and vice versa. I have a function that calculates the sum of the input value and output of an element and returns the result, but when I show in HTML returns: Nan:
Follows 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 the function:
Saldo: R${{getTotal()}}
My model:
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
}
Someone can give me a light?