title: Angularjs: how to show incremental counter (progress message) while ng-repeat is working?
body: <p><strong>Requirement</strong></p>
  
  <p>Suppose, I have an array of <code>10000</code> length. While <code>ng-repeat</code> is repeating and showing the content of the list, meanwhile I need to show a progress message showing how many elements have created.</p>
  
  <p><em>Long story short</em> : <em>show progress message showing how far ng-repeat has reached</em></p>
  
  <p><strong>What I have done</strong></p>
  
  <p>Here is a code that I have done (not working).</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 app = angular.module('app', []);
  
  app.controller('appCtrl', function ($scope, $timeout) {
  
      $scope.list = []; /// list that is going to be repeated
      $scope.count = 10000; /// no of items in the list
  
  
      /// filling the list
      var templist = [];
      for (var index = 0; index &lt; $scope.count; index++) {
  
          templist.push(index);
      }
      $scope.list = templist;
  
      ///  default msg of progress
      var progress = '0/' + $scope.count;
  
      /// function will be called when the the list will be getting rendered
      $scope.reportProgress = function (i) {
          console.log(i);
          setTimeout(function () {
              /// updating the progress message
              progress = i + "/" + $scope.count;
              $("#prog").html(progress);
          }, 1);
      }
  
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Document&lt;/title&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div ng-app="app" ng-controller="appCtrl"&gt;
  
          progress: &lt;span id="prog"&gt;&lt;/span&gt;
  
          &lt;div ng-repeat="i in list track by $index"&gt;
              {{i}} {{reportProgress($index)}}
              &lt;hr/&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>