100
rated 0 times
[
101]
[
1]
/ answers: 1 / hits: 26712
/ 8 Years ago, sun, august 14, 2016, 12:00:00
Anyone know how to get the Firebase unique id? I've tried name()
, name
, key
, key()
. Nothing works.
I am able to see the data but I have no idea how to get the id back. I need it.
//Create new customers into firebase
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);
});
}
More From » node.js