christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

How to switch to a child state without losing hidden params? #370

Open cbranca opened 7 years ago

cbranca commented 7 years ago

Hello, I have a page with two tabs and I need to save the state with Sticky State and DeepStateRedirect. So, when I switch tabs, I expect to get the same state when I go back.

In the tabs i have this: tab1: ui-sref="admin.config.panel.customer" tab2: ui-sref="admin.activity"

My app has these states: page (deepStateRedirect: { default: 'page.config', params: true }) page.config (deepStateRedirect: { default: 'page.config.panel', params: true }) page.config.panel (deepStateRedirect: { default: 'page.config.panel.customer', params: true }) page.config.panel.customer page.config.panel.edit page.activity

The default state of tab1 is page.config.panel.customer with params null, but if i select a customer from the tree inside page.config i can go to page.config.panel.customer or page.config.panel.edit passing hidden parameters (example: customerId and userId). The problem is that if I am in page.config.panel.customer or page.config.panel.edit, and i go to tab 2, and then I go back to tab 1, it returns me to admin.config.panel.customer with params null, but I want go back to page.config.panel.customer or page.config.panel.edit state with the params that I passed.

If i put ui-sref="admin.config" in the tab1 it gives me "Error: Transition prevented". So I really can't figure out how to solve this. Any help?

cbranca commented 7 years ago

If i put ui-sref="admin.config.panel" in the tab1 seems to work, but it continues to give me "Error: Transition prevented". The only solution I found is to put "$qProvider.errorOnUnhandledRejections(false);" in the config. Is it ok to use such solution?