title: How to detect the Browser refresh and Close events in Angular JS?
body: <p><em>Hi  i have tried the below event to detect but sometimes it doesn't fire the event, while closing the tab or Browser.</em></p>
  
  <pre><code>$window.onbeforeunload
  </code></pre>