title: How do I display a list of objects based on a specific property in Angularjs?
body: <p>I have a one to many model of related collections in mongodb where a doc in the child collection includes the id of a doc in the parent collection. I'm trying to display all children when viewing the parent.</p>
  
  <p>When viewing the parent, I have an ng-repeat that displays the entire child collection. I'm struggling with filtering the child collection so that it only displays results that include the parent id.</p>
  
  <p>Here's my HTML:</p>
  
  <pre><code>&lt;div&gt;{{parent.name}}&lt;/div&gt;
  &lt;div ng-repeat="child in children | filter: {id: {{parent.id}}}"&gt;
      {{child.name}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's my js:</p>
  
  <pre><code>app.controller("parentCtrl", function($scope, $location, $routeParams, $http) {  
      //Get parent 
      $scope.children = [];
      $http.get('/children').success(function(children) {
          $scope.loaded = true;
          $scope.children = children;
      });
  });
  </code></pre>
  
  <p>The code successfully gets the parent and loads all docs in the child collection. Can I use a filter in my ng-repeat to pull just the children? If not, is there a best practice to get docs from a related collection?</p>