My use-case was similar to the iOS window management where sub-app view state is frozen in time and reestablished as you navigate.
After delving in some more I decided it would be better to take a different approach with the UI than invest any more time to solve the feature. It hasn't come up since so I'm not aware of any good solutions. On Monday, 27 October 2014 01:22:22 UTC-7, Dan Dascalescu wrote: > > A year later - any updates on the sanctioned way to preserve expensive > elements? I have a Google Maps that I want preserved (center, zoom etc.) > when navigating among routes, and this seems like a basic enough feature of > a routing package that it should already be implemented. > > So far I've only found an add-on to ui-router, called ui-router-extras, > which didn't work > <https://github.com/christopherthielen/ui-router-extras/issues/86> out of > the box. > > On Wednesday, October 2, 2013 2:30:53 PM UTC-7, Ruaidhrí Devery wrote: >> >> Oh I see, I'll give it a try. If I can get something working how I want >> I'll post up a fiddle >> >> Thanks for the help! >> >> R >> >> >> On 2 Oct 2013, at 12:12, Sebastien Vincent wrote: >> >> You don't recompile the template each time, you redraw. Compile is to >> bind, not to draw. You can reuse dom element when you redraw, as long as it >> reflect the data and it is properly unit tested. If you do thing in order, >> it'll be easy to get thing working and only then optimize. >> >> On Thursday, October 3, 2013 2:20:43 AM UTC+8, Ruaidhrí Devery wrote: >>> >>> ng-repeat triggers $animate#move >>> <http://docs.angularjs.org/api/ng.$animate#move> to reposition DOM >>> elements so as to "reuse the associated scope/element" >>> >>> I think that this is as much for usability as it is optimization. >>> Re-compiling the template every time the order changes is a real issue for >>> UI continuity*. >>> >>> What I'm trying to achieve is a similar. I'm hoping to maintain the >>> continuity of a list of elements, only my list structure requires elements >>> to be moved between root nodes not just within them. >>> >>> rur >>> >>> * and also for control requiring granular component state to be moved up >>> the scope hierarchy. >>> >>> >>> >>> >>> On Tuesday, 1 October 2013 20:11:51 UTC-7, Sebastien Vincent wrote: >>>> >>>> I don't think ng-repeat moves DOM around, it keeps data and >>>> presentation separated and redraw on change. >>>> >>>> The point of scope is to "maintain the component state for the duration >>>> of execution". $compile allows you to create a new scope for your template >>>> at the target. Then you need to move data between the old scope and new >>>> scope and it will look like the data has moved. >>>> >>>> On Wednesday, October 2, 2013 8:07:47 AM UTC+8, Ruaidhrí Devery wrote: >>>>> >>>>> Yea I remove and reinsert the element. I did try $compiling the >>>>> element before reinserting, but as expected it clobbered the state within >>>>> the include tag. >>>>> >>>>> I'm going to take a closer look at the ng-repeat implementation and >>>>> see how it moves DOM nodes around. If I find anything useful I will post. >>>>> >>>>> rur >>>>> >>>>> >>>>> >>>>> >>>>> On Tuesday, 1 October 2013 15:35:44 UTC-7, OpenNota wrote: >>>>>> >>>>>> I lose Angular mouse event bindings (at least). >>>>>> >>>>>> >>>>>> Do you remove element from DOM and then reinsert it? If so, then you >>>>>> probably need to $compile it after. >>>>>> >>>>> >> -- 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.
