Hi, I need to capture the name of the childs 10de2017 and 11de2017 from the following image database:
InitiallyItriedthefollowing:
vardatasWO=firebase.database().ref().child("WO"); //acesso o primeiro child depois do ref.
datasWO.on("child_added", function (snap2){
snap2.forEach(function(childSnap){
console.log(childSnap.key); //e então mostro o nome deles
});
})
In this case it returns the names of childs
that are inside 10de2017
and 11de2017
.
I already tried to use child.parent.key
(which would logically return 10de2017 and 11de2017) but I get an error message in the console: Cannot read property 'parent' of undefined
. I need to list those nodes to automatically add them to a select html.