title: Run angular function on an interval but wait until previous call is completed
body: <p>I know how to run a function with an interval using angular however what is the cleanest way to run a function every x seconds but wait until the previous call is completed.  Sometimes ajax calls can get stuck and take longer for whatever reason, so I don't want several calls to get clogged up. </p>
  
  <p>Is the best way to just have a boolean flag everytime a call starts and ends and check for that or a more simplified way.</p>