admin管理员组

文章数量:1192929

This is my Firebase Database:

I need the URLs of the images that are associated alongside the unique random name generated by the push method. Is there any way I could do that? Also, there must exist a better way of sending data. Please, let me know. Thanks.

imgRef.on('value', function(snapshot) {
console.log(snapshot.val());
});

This is, as expected, returning the entire JSON object. I need the URL.

This is my Firebase Database:

I need the URLs of the images that are associated alongside the unique random name generated by the push method. Is there any way I could do that? Also, there must exist a better way of sending data. Please, let me know. Thanks.

imgRef.on('value', function(snapshot) {
console.log(snapshot.val());
});

This is, as expected, returning the entire JSON object. I need the URL.

Share Improve this question edited Dec 23, 2016 at 1:44 AL. 37.8k10 gold badges145 silver badges284 bronze badges asked Dec 22, 2016 at 21:34 Somanshu SrivastavaSomanshu Srivastava 1712 gold badges2 silver badges6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 27

This is the most basic way to show the list of image URLs:

var rootRef = firebase.database.ref();
var urlRef = rootRef.child("user1/DAA Notes/URL");
urlRef.once("value", function(snapshot) {
  snapshot.forEach(function(child) {
    console.log(child.key+": "+child.val());
  });
});

本文标签: How to get the value of children in Firebase JavascriptStack Overflow