I have the following JSON
"colecao" : {
"id" : {
"subid1" : 2,
"subid2" : 1
}
}
Use the following commands to get realtime data
var dbrealtime = firebase.database();
var query = dbrealtime.ref('colecao');
query.on('value', function(snapshot) {
console.log(snapshot.val().id);
});
If I do it will get the value "2";
console.log(snapshot.val().id.subid1);
I'd like to make a foreach and show the two values they have in the id without having to reference subid1 and subid2.
Example:
2
1