I want to retrieve the data from my firebase database.
The one that was highlighted in the IMG 1 is the user uid and below it was the value from the push().
This is my code to retrieve the data
var getClassInfo = firebase.database().ref().child('Classes'+ user.uid +
'/');
getClassInfo.on('value', gotData,errData);
function gotData(data) {
//console.log(data.val());
var Classes = data.val()
var keys = Object.keys(Classes);
console.log(keys);
for (var i =0; i < keys.length; i ++){
var k = keys[i];
var TheClass = Classes[k].TheClass;
console.log(TheClass);
}
}
function errData(err) {
console.log('Error!');
console.log(err);
}
How do I ref() the value of the push()?
var getClassInfo = firebase.database().ref().child('Classes'+ user.uid +
[push()]);
How do I retrieve all classroom name from a particular user [TheClass]?