Adir Zoari Adir Zoari - 1 month ago 9
Javascript Question

Get node of data from firebase

i'm trying to get data from firebase and i'm little stuck with that.
enter image description here

i'm trying to get the all SemaA data
i did it like that but it not give me nothing

firebase.database().ref('Courses/'+departmentId+'/SemA'),


i can specific to do (but i don't want it)

firebase.database().ref('Courses/'+departmentId+'/SemA/java'),


i also wnated to get the black sign and red sign in two different queries and run into loop to get the data from there
enter image description here

Answer

If you're looking to loop over the courses in a semester:

var semesterRef = firebase.database().ref('Courses/'+departmentId+'/SemA')
semesterRef.on('child_added', function(courseSnapshot) {
    console.log(courseSnapshot.key);
});