title: Get both the parent and child values in Firebase Database with AngularJS
body: <p>I am using some AngularJS to retrieve values in my Firebase Database under a specified parent tree. I would like to get also the value of this parent.</p>
  
  <p>My database structure:</p>
  
  <p><a href="https://i.stack.imgur.com/W5u6M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W5u6M.png" alt="enter image description here"></a> </p>
  
  <p>So far, my code gets the Name and PhotoUrl of each tripID under a specified UserID. But I would like to get the TripID value as well as the Name and PhotoUrl. The problem is that the TripID value is not in the child tree. How can I retrieve it ?</p>
  
  <p>My JS looks like this:</p>
  
  <pre><code>    var app = angular.module('test', []);
  
  app.controller('MainCtrl', function($scope) {
      var database = firebase.database();
      database.ref(`trips/${userid}/trips`).once('value') 
  
  .then(photosSnap =&gt; {
      var photosObj = photosSnap.val();
      var tripName = Object.keys(photosObj).map(key =&gt; photosObj[key].name);
      var tripPhotoUrl = Object.keys(photosObj).map(key =&gt; photosObj[key].photourl);
  
     $scope.repeatData = tripName.map(function (value, index) {
        return {
          data: value,
          value: tripPhotoUrl[index]
  }
  });
  </code></pre>