title: AngularJS - Synchronous $http.post requests
body: <p>I need to do two $http.post requests in my code. The first one retrieve a key that is used by the second one for looking up a SQL database.</p>
  
  <p>At the moment, they're nested like this :</p>
  
  <pre><code>$http.post(...)
  .success(function(data, status) {
      //Do something
      $http.post(...)
      .success(function(data, status) {
          //Do something else
      }
  }
  </code></pre>
  
  <p>I highly doubt that this is the correct way of doing this. Can't I make the second request wait for the first one, and end up with something like :</p>
  
  <pre><code>$http.post(...)
  .success(function(data, status) {
      //Do something
  }
  
  $http.post(...)
  .success(function(data, status) {
      //Do something else
  }
  </code></pre>