title: Wait for all $http requests to complete in Angular JS
body: <p>I have a page than can make a different number of <code>$http</code> requests depending on the length of a variables, and then I want to send the data to the scope only when all the requests are finished. For this project I do not want to use jQuery, so please do not include jQuery in your answer. At the moment, the data is sent to the scope as each of the requests finish, which isn't what I want to happen.</p>
  
  <p>Here is part of the code I have so far.</p>
  
  <pre><code>for (var a = 0; a &lt; subs.length; a++) {
    $http.get(url).success(function (data) {
      for (var i = 0; i &lt; data.children.length; i++) {
        rData[data.children.name] = data.children.age;
      }
    });
  }
  </code></pre>
  
  <p>Here is the part that I am sceptical about, because something needs to be an argument for <code>$q.all()</code>, but it is not mentioned on the docs for Angular and I am unsure what it is meant to be.</p>
  
  <pre><code>$q.all().then(function () {
    $scope.rData = rData;
  });
  </code></pre>
  
  <p>Thanks for any help.</p>