How to retrieve data from Firebase Database?

前端 未结 3 563
春和景丽
春和景丽 2020-12-13 09:37

I\'m trying to create a simple program that takes name, mobile number and email address from user and then puts the data on Firebase Realtime Database.

There are 3 i

3条回答
  •  我在风中等你
    2020-12-13 09:57

    You could also use dot notation to get the value of the child you are looking for for.

    Below I just commented out the forEach loop from the highest rated answer and added a console.log().

     var leadsRef = database.ref('leads');
      leadsRef.on('value', function(snapshot) {
          // snapshot.forEach(function(childSnapshot) {
            var childData = snapshot.node_.children_.root_.value.value_;
            console.log("snapshot.node_.children_.root_.value.value_: ", snapshot.node_.children_.root_.value.value_)
          // });
      });
    

    At the time of posting this I am using firebase 5.9.1

    src="https://www.gstatic.com/firebasejs/5.9.1/firebase.js"

提交回复
热议问题