I have a javascript object that I need globally for my angularjs application. When the application is unloaded (due to a page refresh or some other script), I would like to save the object to the browser storage. I believe that adding an object to $ rootScope would fulfill the first requirement to make the object global, but writing the object to the repository during the onbeforeunload event onbeforeunload require access to the $ rootScope variable. Can a page load event be detected in angularjs?
angularjs global-variables rootscope onbeforeunload
user1491636
source share