title: Angular nested ng repeat scope with pagination
body: <p>I am using angular with material lib. In project I have two nested loops of ng-repeat with md-tables. Problem is that in nested loops variable is ovveriden each time on each request. I could make one request and iterate, but I have dynamic pagination, and it will not work.</p>
  
  <p>Here is index file with tables:</p>
  
  <pre><code>&lt;div ng-init="getCategories()" flex&gt;
  ...
   &lt;div class="content-main"  ng-repeat="category in categories"&gt;
  ...
      &lt;md-content&gt;
          &lt;table md-table ng-init="getBooks(category.id)"&gt;
             ...
             &lt;tr md-row ng-repeat="book in books | orderBy: query.order "&gt;
                  &lt;td md-cell&gt;
                      &lt;span&gt;{{ book.title }}&lt;/span&gt;
                  &lt;/td&gt;
      ...
      &lt;/md-content&gt;
      &lt;md-table-pagination md-limit="query.limit"
                           md-limit-options="limit"
                           md-page="query.page"
                           md-page-select="options.pageSelect"
                           md-total="{{booksCount}}"
                           md-boundary-links="options.boundaryLinks"&gt;
      &lt;/md-table-pagination&gt;
  </code></pre>
  
  <p>Simplified angular controller functions:</p>
  
  <pre><code>$scope.getCategories = function () {
   \\get request
    $scope.categories = resp.data.rows;
    }
  
  $scope.getBooks = function () {
   \\get request with pagination and search params
     $scope.books = resp.data.rows;
     $scope.booksCount = resp.data.amount;
    }
  </code></pre>
  
  <p>So every request getBooks ovverides "books" variable, and now for example I have two categories abd I see same books (from category 2) for both.</p>
  
  <pre><code>Category 1
   Book C Book D
  Category 2 
   Book C Book D
  (wrong)
  </code></pre>
  
  <p>But I have for Category 1 another books:</p>
  
  <pre><code>Category 1
   Book A Book B
  Category 2 
   Book C Book D
   (correct)
  </code></pre>