Does anyone know how to get a unique Firebase ID? I tried name(), name, key, key(). Nothing works.
I can see the data, but I have no idea how to return the identifier. I need it.
function saveCustomer(email) {
firebase.database().ref('/customers').push({
email: email
});
firebase.database().ref('/customers').on("value", function(snapshot) {
console.log(snapshot.val());
console.log(snapshot.value.name());
}, function(errorObject) {
console.log("The read failed: " + errorObject.code);
});
}
source
share