Reputation: 1
I want to get child name
Coffee Latte Tea Ade
How can I get these?
Upvotes: 0
Views: 94
Reputation: 791
You probably looking for this documentation Work with List of Data
var ref = firebase.database().ref('Menu/Drink');
ref.once('value', (snapshot) => {
snapshot.forEach((childSnapshot) => {
var drinkName = childSnapshot.key; // <- this is your Name
var drinkValue = childSnapshot.val();
});
});
Real-time database always uses key-value objects (even when you create Array it will use 0,1...n number as key). So you can get any object as a collection and iterate through snapshots like items.
Upvotes: 1