1

I have a server API which holds session state in the form of managed objects. Unfortunately, there is no way to get references to those managed objects apart from when they are created.

This means there is a need to destroy the objects when the web application is finished with them (otherwise they accumulate on the server and eventually I hit a limit where no more can be created). I have this cleanup code in controller destroy event handlers, but they don't seem to be called when the user, say, refreshes the browser.

What's a proper Angular-ish way to call cleanup code on refresh or close? Is there such a pattern or should the server API be refined to provide a way to get such references? Unfortunately, I'm not in a position to be able to change the server API easily.

  • No specific angular way, but you can have a look at http://stackoverflow.com/questions/3888902/javascript-detect-browser-close-tab-close-browser – floribon Mar 16 '15 at 23:36

0 Answers0