Keep State of UI for View

Is there any way with angular-ui-router to actually preserve the state of the UI like most native apps do?
For example, if I was on the home view and I clicked an accordion list which expanded, then clicked on that item inside the list and navigated to another view. Next, I decide to go back to the home view. The result I would like to have is the accordion list still expanded when navigating back to the home view.

Is there any way to preserve the actions/state of UI we navigating back and forth between views instead of a complete refresh of the view?

I think I may have found something that may work. Its called UI-Router Extras.

1 Like

I wonder if this would reduce the rendering of the previous state? If so, it would be very nice. I could not deduce whether this would work sort of like cached state and render it much quicker than how it works currently.

Hmm…It seem like I’m having a hard time using UI-Router-extras with my ionic app(my app does not include tabs).

Here’s a codepen to show an example.

I want to be able to keep the state of the accordion expanded UI when returning to the home page.

use nested states and view states are preserved

Patrick, could you please share a link to a working example or sth that could help understand this or see in action? I’m fighting with this without success as described here Prevent controller from reloading/rebuilding on state change and I’m ready to give up :frowning:

I believe I attempted nested states in this code pen below,(correct me if I didn’t do it right), but I still can not get the accordion to stay expanded when return the previous state/view. Plus, the controller is reloading on return to state.

I wonder if it has something to do with the way ionic uses accordions(css & ng-show/hide).

@markace1246: I agree that this, together with @rafaellop’s question, seems like an essential problem and I’d love to hear if you guys had any luck figuring it out? I’m bumping my head against the same thing…Thanks!

Same issue +1. I tried ui-router-extras but it’s seems not working with ionic.