Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

Controller reloaded when params in route #380

Open
that1guy opened this issue Aug 9, 2018 · 2 comments
Open

Controller reloaded when params in route #380

that1guy opened this issue Aug 9, 2018 · 2 comments

Comments

@that1guy
Copy link

that1guy commented Aug 9, 2018

The initial transition to the sticky state works well, but when you transition away and then come back to the sticky state, the view reloads and the controller re-runs (thus losing any changes made on that scope/view). This issue only happens when $stateParams contains a javascript object.

See my plunk here: http://plnkr.co/edit/b9zpVyApL6tx2pe8XoZz?p=preview

(Initial state is app.survey)

  1. Click on the Property Details Page tab
  2. Click the Go back to app.survey on the property details page
  3. Notice that the controller is reloaded

This issue is realted to #239. but you fixed that scenario. I'm not sure what I'm doing differently to be reproducing this issue. I'm using the latest ui-router legacy and ui-router-extras

Thanks for help.

@that1guy
Copy link
Author

@christopherthielen any chance you could help with this one real quick? Just point me in the right direction.

@nmoinvaz
Copy link

nmoinvaz commented Jun 7, 2019

I discovered that this is happens when trying to navigate to the saved UI sticky state without the exact same params that are specified in .state(). In other words, if it detects that the stateParams have changed, it will reload. If upon initialization you create the state with certain parameters, the next time you navigate to it you should specify the exact same parameters.

Also in issue #273, there is an interest approach to prevent having to pass the same parameters each time, and that is to create an intermediate state.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants