title: Angular ng-repeat - how to join or combine data from different arrays
body: <p>I'm trying to join/combine two arrays in angular ng-repeat.</p>
  
  <p>Simple example book/author where I want to print book titles with coresponding author name.</p>
  
  <p>Books are in one array, authors in another. </p>
  
  <p>How to join data in this example?</p>
  
  <p>JSFiddle: <a href="http://jsfiddle.net/1jxsh0x3/" rel="nofollow noreferrer">http://jsfiddle.net/1jxsh0x3/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var myApp = angular.module('myApp', []);
  
  function MyCtrl($scope) {
  
    $scope.authors = [{
      id: "1",
      name: "John"
    }, {
      id: "2",
      name: "Peter"
    }, {
      id: "3",
      name: "Mark"
    }];
    
    $scope.books = [{
      id: "1",
      id_author: "3",
      name: "Book Lorem"
    }, {
      id: "2",
      id_author: "1",
      name: "Book Ipsum"
    }, {
      id: "3",
      id_author: "1",
      name: "Book Dark"
    }];
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"&gt;&lt;/script&gt;
  &lt;div ng-controller="MyCtrl"&gt;
    &lt;div ng-repeat="book in books"&gt;
      &lt;div&gt;Book title: {{book.name}}&lt;/div&gt;
      &lt;div&gt;Authors name: {{authors[$index].name}}&lt;/div&gt;
      &lt;hr&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>