As far as I know, the browser treats each window as a separate memory space (so shared objects are right out) and each reload/refresh event as a total restart. You could try being clever with localStorage (although rapid-fire clicks would probably lead to a race condition as you can't really guarantee instantiation order of the tabs, I imagine).
It would also be helpful to store all relevant variables in your path, but if that's not available, you may need to look into using some kind of cross-window communication. I *think* (I've never actually tried this) that a tab opened via open-in-new-tab maintains a reference to the parent window in window.opener, so could get get clever with all kinds of message events. Best bet is storing unreconstructable state in the URL, I think. That seems to me like what it's for. e On Wed, May 21, 2014 at 6:56 AM, Srikar Shastry <[email protected]>wrote: > Hello, > I have two pages each supported by respective controllers. Now, I want to > pass variable from first controller to another as later utilizes it as get > query parameter (not the path parameter). I tried services but when user > right clicks and clicks "open link in a new tab", the second controller > receives am empty var. Same happens when user reloads the page. I tried > local storage but the problem with that is when user tries to open > multiple links, all point to the latest variable(true since local storage > is being overwritten with latest vars as user clicks on links). Any idea on > how to restrict services from reseting on page reload? > > -- > 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/d/optout. > -- 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/d/optout.
