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

Sticky state's view/ctrl is being reloaded when passing an object on $stateParams via the 'params' property #239

@aaronpikkarainen

Description

@aaronpikkarainen

Greetings,

I've come across an issue when using sticky states (with deep state redirect) and passing objects as state parameters via the 'params' property of a state. 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. Using only primitive params on the URL works fine, but there are cases when we need to pass complex objects to a state.

I took the Simple Sticky States Example (http://plnkr.co/edit/bFMLqLENmPFfCD0XCz8V?p=info) and made three small changes to it to demonstrate the issue. See my fork here...

http://plnkr.co/edit/0Zgn7IxvNDsT5kgcRjDO?p=info

You will see the issue when you follow these steps:

(Initial state is tabs.account.stuff)

  • Enter text into the input box underneath "Here's my stuff"
  • Click on the 'Survey' tab
  • Click back to the 'Account' tab, which goes back to stuff because of DSR
    (the input becomes empty because the view and controller get reloaded even though it's part of a sticky/dsr group of states)

My plunker changed the following three lines of code...

  • script.js - line 7
    image
  • script.js - lines 31 & 32
    image

Thanks!

Metadata

Metadata

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions