title: How to assign value in $scope inside ng-repeat angularJS
body: <p>I have a problem now regarding the ng-repeat in angularJS on how to assign value in $scope inside ng-repeat..</p>
  
  <p>This is my scenorio:</p>
  
  <p>I have a json file that content all the data. It shows like this..</p>
  
  <pre><code>[
  {BookID:1,Chapter:1,ContentID:1,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:1,ContentID:2,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:1,ContentID:3,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:1,ContentID:4,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:2,ContentID:1,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:2,ContentID:2,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:2,ContentID:3,Content:"The quick brown fox is nice"},
  {BookID:1,Chapter:2,ContentID:4,Content:"The quick brown fox is nice"},
  {BookID:2,Chapter:1,ContentID:1,Content:"The quick brown fox is nice"},
  {BookID:2,Chapter:1,ContentID:2,Content:"The quick brown fox is nice"},
  {BookID:2,Chapter:1,ContentID:3,Content:"The quick brown fox is nice"},
  {BookID:2,Chapter:1,ContentID:4,Content:"The quick brown fox is nice"}
  ]
  </code></pre>
  
  <p>Now that is my Example data..</p>
  
  <p>When Book 1 is click, I want to Display it like this..</p>
  
  <pre><code>Book 1
  
  Chapter 1
  1 The quick brown fox is nice. 2 The quick brown fox is nice. 3 The quick brown fox is nice. 4 The quick brown fox is nice
  
  Chapter 2
  1 The quick brown fox is nice. 2 The quick brown fox is nice. 3 The quick brown fox is nice. 4 The quick brown fox is nice
  </code></pre>
  
  <p>This is my Code:</p>
  
  <pre><code>//Chapter is expected in every book so i just loop it depending on expected chapters (e.i, 1,2,3,4
  
  &lt;div data-ng-repeat="chap in Chapters"&gt;
          &lt;span style="font-size:20px"&gt;{{chap}}&lt;/span&gt;
          &lt;span data-ng-repeat="testament in Testaments | filter:filters"&gt;
              &lt;b&gt;{{testament.ContentID}}&lt;/b&gt; {{testament.Content}}
          &lt;/span&gt;
          &lt;br /&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>In my Controller :</p>
  
  <pre><code>$scope.filters = function (row) {
          var bookId = row.BookID.toString();
          var chapter = row.Chapter.toString();
          return ( bookId == $scope.bookId &amp;&amp; chapter == $scope.currentChapter);
      };
  </code></pre>
  
  <p>Now the Problem is that where i can get the <code>$scope.currentChapter</code> which must the value of <code>chap</code></p>
  
  <p>Please help me how assign value to <code>$scope.currentChapter</code> from the <code>chap</code></p>
  
  <p>Thank you so much..</p>