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.
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.
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.
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.
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.