title: Error: Firebase.child failed: First argument was an invalid path: "undefined"
body: <p>I'm getting the following error when pressing the <strong>View Post</strong> link <em>(navigating to the</em> <code>posts.postview</code> <em>state)</em> in my Angular, ui-router &amp; Firebase app:</p>
  
  <p><code>Error: Firebase.child failed: First argument was an invalid path: "undefined". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"</code></p>
  
  <p>On the main page of the app I have a list of 4 posts. The data from these posts are being fetched from Firebase. Each post has a link to the post page via a <strong>View Post</strong> link like in the following screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/sHMrj.png" alt="enter image description here"></p>
  
  <p>When I click the <strong>View Post</strong> link I see the post page load but I will get the above Firebase error and the Firebase data will not populate the template <em>(postview.tpl.html)</em> as shown in the screenshot below:</p>
  
  <p><img src="https://i.stack.imgur.com/JIWcD.png" alt="enter image description here"></p>
  
  <p>I have an updated minimal version of the app running here in Plunker </p>
  
  <p><a href="http://plnkr.co/edit/bGqFZ2VI7OSrO0myDjkq?p=preview" rel="nofollow noreferrer">http://plnkr.co/edit/bGqFZ2VI7OSrO0myDjkq?p=preview</a></p>
  
  <p>Also, here is the controller and service files related to fetching the post data:</p>
  
  <hr>
  
  <p><strong>postview.ctrl.js</strong> </p>
  
  <pre><code>app.controller('PostViewCtrl', function ($scope, $routeParams, Post, Auth) {
      $scope.post = Post.get($routeParams.postId);
      $scope.comments = Post.comments($routeParams.postId);
  
      $scope.user = Auth.user;
      $scope.signedIn = Auth.signedIn;
  
  });
  </code></pre>
  
  <p><strong>post.serv.js</strong></p>
  
  <pre><code>app.factory('Post', function ($firebase, FIREBASE_URL) {
      var ref = new Firebase(FIREBASE_URL);
      var posts = $firebase(ref.child('posts')).$asArray();
  
      var Post = {
          all: posts,
          get: function (postId) {
              return $firebase(ref.child('posts').child(postId)).$asObject();
          }
      };
  
      return Post;
  });
  </code></pre>
  
  <hr>
  
  <p>Any ideas on what's wrong here?</p>