Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS: remembering state/setup of complex views with routes
    primarykey
    data
    text
    <p>In a single page application, is there a way of switching back and forth to an AngularJS route and to display it back in the same state as it was shown before?</p> <p>Usually this would be implemented by binding data in a parent scope. While this is easy to set up for lightweight view, it can be cumbersome when doing it for views holding lots of graphical elements.</p> <p>Here is an example, where having the previous route state remembered could enhance user experience: on the following page, imagine that </p> <ul> <li>you stand on Item 1 and select Tab 2</li> <li>then move to Item 2</li> <li>finally switch back to Item 1: Tab 2 is not selected anymore :-(</li> </ul> <p><a href="http://angular-route-segment.com/src/example/#/section1/1">http://angular-route-segment.com/src/example/#/section1/1</a></p> <p>It seems the views are destroyed/constructed when switching back and forth between routes.</p> <p>A solution would be about storing the state of the user interface in a parent scope but it has the following pitfalls:</p> <ul> <li>creating an object storing all the little details of the user interface</li> <li>creating complex logic about -saving and- resetting the UI in the same state as before</li> <li>storing UI state in a data model does not sound that MVC-ish</li> </ul> <p>Using show/hide of div storing the views saves the state but then no route is used and the switching business must be implemented by hand. I like using routes because 1. of the browser history navigation (hash in the url) and 2. it is easy to set up.</p> <p>Having the UI state not remembered is like having Chrome to reload pages when switching back and forth between tabs: not very user friendly.</p> <p>Is there an Angular-way?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload