search

Home  >  Q&A  >  body text

angular.js - How to listen to browser close event in angular js

Using angular to develop web, I want to save the current data to localStorage when the user closes the browser. But there is no way to monitor the browser closing event in the controller. Please give me some ideas! ! Thank you so much!

为情所困为情所困2779 days ago738

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:11:24

    angularjs should not have this method, you can try window.onbeforeunload.

    reply
    0
  • Cancelreply