I have put together a plunk to demonstrate, i would really appreciate the 
benefit of your expertise...

'http://plnkr.co/edit/9a4e9P?p=preview'

If you run in the plunker preview window, clear your cookie cache and hit 
the 'manually trigger a refresh of the preview' button you will get 
something like the following in the console window:

unloadProcessing() called $cookies:
Object {____cookieVal2: ""value 2 set in startup!""}
unloadProcessing() returning $cookies: 
Object {____cookieVal2: ""value 2 set in startup!"", ____cookieVal1: ""set 
in unloadProcessing!""}
startup() called $cookies: 
Object {____cookieVal2: ""value 2 set in startup!""}
startup() returning $cookies: 
Object {____cookieVal2: ""value 2 set in startup!""} 

Is it too late by the time the 'unloadProcessing' method is called to make 
changes to $cookieStore?

Many thanks

On Wednesday, January 22, 2014 5:01:20 PM UTC, Gary Cuthbert wrote:
>
> Hello,
>
> I am currently investigating the use of $cookieStore to record some 
> trivial application settings and would like to update the $cookieStore when 
> the application is going through the process of tear down (either when the 
> user hits the browser reload button or closes the window or navigates away 
> from the application).
>
> Is this possible? I have a controller associated with my main <div 
> ng-app="app"> element and I have tried trapping for $destroy in this 
> controller and attempting the updates in its handler but the event is not 
> trapped.
>
> I could update the $cookieStore periodically in this case but i suspect 
> sooner or later i will need to be able to perform application cleanup logic 
> so in general how would/can you detect that an angular application is about 
> to close?
>
> Many thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to