title: AngularJS wait for ajax request to complete
body: <p>I have a AJAX request that's invoked in an interval of every 10 seconds, but I want to be able to call the AJAX only after my previous request is completed.</p>
  
  <pre><code>$interval(function () {
              $scope.getContent(2);
          }, 10000);
  </code></pre>
  
  <p>With the above code, the ajax request is performed every 10 seconds irrespective of my previous request being completed. How can I achieve that?</p>