0
I have the following registration at firebase:
And I’m trying to get the values "Female", "Male" and "Mixed" of each record and in case it is "true" I mark a checkbox, but apparently my code is not validating record by record but all at once
My code (I haven’t implemented all conditions yet I’m testing with only one):
var db = firebase.database().ref("modality");
db.once("value", function(snapshot){
snapshot.forEach(function(child){
if ( child.val().female == "true" ){
inputModalityFemale.checked = true;
} else {
inputModalityFemale.checked = false;
}
console.log(child.val().mixed);
});
});
Would anyone have any tips?
In this case using your suggestion I got : Uncaught Typeerror: snapshot.val(...). foreach is not a Function
– Rafael Quintella
if vc der console.log() in snapshot.val(), what appears there on the console?
– Pedro Junior
logger.ts:84 [2019-05-26T13:25:57.238Z] @firebase/database: FIREBASE WARNING: Exception was thrown by user callback. Typeerror: snapshot.val(...). foreach is not a Function Uncaught Typeerror: snapshot.val(...). foreach is not a Function
– Rafael Quintella