title: Is it possible to fire a modal when the user attempts to close the browser with AngularJS?
body: <p>like says my title...</p>
  
  <p>Is it possible to fire a modal when the user attempts to close the browser with AngularJS? I need to show the modal for the user to fill out a survey.</p>
  
  <p>If that is possible, have u some tuto? I have trying the next code in my controller, but displays a confirm window.</p>
  
  <pre><code>$window.onbeforeunload = function (event) {
  var message = 'If you leave this page you are going to lose all unsaved changes, are you sure you want to leave?';
  if (typeof event == 'undefined') {
  event = $window.event;
  }
  
  return message;
  };
  </code></pre>
  
  <p>Thanks for ur help.</p>