title: Angular $http - process response data while receiving it
body: <p>I'm building a simple UI that communicates with my backend server.
  The UI sends to the server a URL to process, and the server would return a list of results.</p>
  
  <p>Regarding results, each result takes time to calculate, yet I would still like to show the incoming results in the UI, maybe even use <code>ng-repeat</code> on the set of results which will be updated as results are being received from the server.</p>
  
  <p>The problem is, Angular's $http service returns a promise that can only handle success and failure states.</p>
  
  <p>I was wondering if there's some kind of "ongoing" state that I can run a callback function on.</p>
  
  <p>For example,
  The results are JSON containing an array of results:</p>
  
  <pre><code>{
    results: [
      {prop1: val1, prop2: val2}, // result 1
      {prop1: val1, prop2: val2}, // result 2
      {prop1: val1, prop2: val2}, // result 3
      {prop1: val1, prop2: val2}  // result 4
    ]
  }
  </code></pre>
  
  <p>Just imagine that it takes 5-6 seconds to calculate before each of the results are ready to be sent in the response.</p>
  
  <p>So, the wanted flow and behavior is this:</p>
  
  <p>UI:</p>
  
  <ol>
  <li>Sends a <code>POST</code> request containing all the details required by the server.</li>
  <li>On each line received, push the result contained in that line to <code>$scope.results</code>.</li>
  </ol>
  
  <p>The rest will be done by the digest loop and <code>ng-repeat</code> will make sure I see them on screen.</p>
  
  <p>So the only problem I have, is how do I access the response data while it is being received?</p>
  
  <p>Btw, if you have any suggestions to do it in another way, I'd be glad to hear, as long as it's simple... it is really a simple UI, nothing advanced is needed here.</p>
  
  <p>Thanks a lot.</p>