Possible to load controller only once for tabs and navigation view?

I had created a pen here:
http://codepen.io/CoreMaker/pen/rGKjF

The controller seems to load every time it enters the state. This is really troublesome if we want to simulate the native navigation view. Any workaround to this? Thanks.

And this topic below is exactly what I bump into:

After digging around a bit, I think this could be our solution to this problem.
http://christopherthielen.github.io/ui-router-extras/#/home

Yep but this is a wanted behave.
Because in most cases it is necessary / wanted to execute the controller everytime you enter the stage.

If you have data to be handled not state-dependend or something like this. you can use angular services.

For the “DeepNested” function… you can use ui-routers abstract states to nest your views deep… if you navigate in substates of a abstract state the abstract state around is not loaded each time.

Or maybe I do not get it^^.

I know that we can use angular services. But look at the codepen that I’ve shared, what if you have multiple pages that show different users’ profiles? Save all the user profiles that I have along the navigation inside the service? As of ui-router-extra, I’m still playing around with it to see if it can really solve my problem. But yeah, would really love to have this fixed. :smiley:

Just did some deeper readings, there’s a line stated on ui-router-extras.

Deep State Redirect can be used with StickyStates, or on its own. If used with a Sticky State, the states will be reactivated, and the DOM will be unchanged (as opposed to the states being re-entered and controllers re-initialized)

Can any core team member take a look at this? Thanks.

Yeah for different profiles i would build up an array and would have a state that shows a user profile^^.

The thing, with the DOM “cache” seems to be very interesting for page transition speed.

With sticky states, the dom isn’t “cached” really. When its state is inactivated, the dom remains fully live in the browser but it is hidden by ng-show directive.

Ohh how ugly… i think about big lists with many images and so on… nice to hold everything hidden in the dom :smile: