1
votes

Seems like $state.go('statename') works like a back button in the browser. A cached Type.

I need to refresh the page when state changes like clicking the refresh button in the browser.

I need to reload/refresh the full page when the state changes, basically re-initializing the controller.

Tried with $state.go('statename', {}, {reload: true}), but with no effect.

Help would be appreciated

1
Could you please be more precise about what you're expecting to happen, and what happens instead? reload will reload the controller, but won't restart the whole app. But of course, if you have in-memory state in the app, that won't be reset. It's probably a design problem, but it's hard to advice without a clear problem, and without any code. - JB Nizet
What's happening--$state.go('statename') taking me to 'statename' state but doesnot reinitialize the controller, as a result the view associated with 'statename' doesnot refresh.... What I am expecting --- $state.go('statename') should reinitialize the controller and the view associated with it should refresh the page full. Basically what happens when we use PHP, .Net etc to navigate between pages(browser reloads) - user6202450
It will create a new instance of the controller associated to that state if you specify {reload: true}. - JB Nizet
I have used that..but with no effect - user6202450
It does have an effect. I've used that successfully a whole lot of time. Post a complete minimal example, in a plunkr, reproducing the problem. Or at least, elaborate on your actual problem, and post your code. - JB Nizet

1 Answers

0
votes

If you don't mind injecting $window, you can try with $window.location.reload()