Skip to content

Instantly share code, notes, and snippets.

@marti1125
Created June 22, 2017 22:47
Show Gist options
  • Save marti1125/b783660fdd7189591d2d9e72af0a0774 to your computer and use it in GitHub Desktop.
Save marti1125/b783660fdd7189591d2d9e72af0a0774 to your computer and use it in GitHub Desktop.
firebase get all rows
// get all rows
var query = firebase.database().ref("result").orderByKey();
query.once("value")
.then(function(snapshot) {
snapshot.forEach(function(childSnapshot) {
// key will be "ada" the first time and "alan" the second time
var key = childSnapshot.key;
// childData will be the actual contents of the child
var childData = childSnapshot.val();
console.log(childData)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment