title: Passing variable to promise in a loop
body: <p>I have a promise in a loop, and I don't know how to pass some scope variables into the promise handler.</p>
  
  <pre><code>for(var i in superarray){
      MyService.get(superarray[i].externalID).then(function(r){
          console.debug(i);
  });
  </code></pre>
  
  <p>MyService is a working service, with a get method that return a promise.</p>
  
  <pre><code>app.factory('MyService', function($http,$q) {
    return {
       get : function(itemID){
          var deferred = $q.defer();
          $http.get('/someresturl/'+itemID).then(function(e) { 
                  deferred.resolve(e.data);
          }, function(reason) {
                  deferred.reject(reason);
          });
          return deferred.promise;
      }
  });
  </code></pre>
  
  <p>In my console, the console.debug logicaly doesn't display 1,2,3,4,5. But 5,5,5,5,5. (there are 5 elements in my superarray).</p>
  
  <p>How can I pass 'i' value in my promise scope, so I can use it in the then() ?</p>
  
  <p>Is it possible?</p>