angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.53k stars 3k forks source link

ui.router.state.$state options (optional) reload (v0.2.5) #1933

Closed borm closed 9 years ago

borm commented 9 years ago

http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state

reload (v0.2.5) - {boolean=false}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.

Where version 0.2.5? Or how reload page after state.go()

borm commented 9 years ago

I have find only one solution state.go('myState') change to location.href = '/myStateUrl'

eddiemonge commented 9 years ago

Why are you using such an old version? Latest is 0.2.14. Try upgrading to that (or 0.2.13) and see if your issue is fixed.

the-simian commented 9 years ago

I might be able to help, It appears the poster is referencing the docs here : https://github.com/angular-ui/ui-router/wiki/Quick-Reference#reloadonsearch-v025

I will say that there appears to be some breaking change introduced in the latest version of ui-router. When using state.go to transition to a state you are already in, I am experiencing a bug where it will not update the params and transition anyways (such as on a search page, using params to indicate the various search params)

I will post more when I zero in on what is actually calling the break. Even passing the { reload: true } options as an optional third parameter is not forcing a reload, currently.

I can confirm the bug is in 0.2.14 and not0.2.13 I will submit a separate issue for it if I can.

christopherthielen commented 9 years ago

@the-simian does your state have reloadOnSearch=false? . Also check if the activity in #1079 affects your issue.

Please submit your new issue ASAP since we want to get 0.2.15 out right away to fix the bugs introduced in 0.2.14 that are not in 0.2.13

the-simian commented 9 years ago

@christopherthielen I checked for that also, sorry I failed to mention it. I was wanting to try and repro with a plunkr. I'll go ahead and get the issue open, to catch anyone else looking for the same thing.

the-simian commented 9 years ago

1963 now is created. I will try and make a simple example to repro.

christopherthielen commented 9 years ago

@bORm can you please clearly state what the problem is? I cannot tell what you are asking.

borm commented 9 years ago

@christopherthielen

"name": "angular-ui-router", "version": "0.2.14",

I need reload page in browser after state.go('myState') complete

christopherthielen commented 9 years ago

you want to reload the browser? Like re-fetch the JS and HTML and CSS from the server?

If so, that's not a function of UI-Router. Use standard browser functions instead: https://developer.mozilla.org/en-US/docs/Web/API/Location/reload

However, if you simply want to reload the UI-Router state (remaining in the running SPA), then use $state.go('myState', {}, { reload: true });

borm commented 9 years ago

@christopherthielen I know that, I thought that you have a method to reload the page

Close

eddiemonge commented 9 years ago

@christopherthielen not $state.reload()?

christopherthielen commented 9 years ago

@eddiemonge $state.reload() would probably be better, yes