title: Angularjs - Call function before page refresh?
body: <p>If a user hits refresh, I want to call an angular service to save their work, and upon completion of the save (asynchronous call), only then should the page refresh. How can I achieve this?</p>
  
  <p>So far I've tried calling the save service outside angular, using window.onbeforeunload. But no luck. Any general advice on how to approach this? How does Angular handle page refreshes?</p>