Is there anyway to change a url without reloading the controller, I am using angular ui-router and my url Structure is like /:param1/data/:param2 on some button click i am changing the url to demo1/data/demo2 to demo3/data/demo4 using $location.path('demo3/data/demo4'), this reloads the controller and hence the state is also lost. I just want to change the url without reloading the controller.
Asked
Active
Viewed 106 times
1 Answers
1
Try using $state.go() like this:
$state.go('currentStateName', {param1: 'demo3', param2: 'demo4'})
I couldn't verify, but it should not reload if the state stays the same.
For further reading check out TransitionOptions (1). A third optional argument for $state.go(). It contains an option 'reload', which is false by default.
[1]: https://ui-router.github.io/ng1/docs/latest/interfaces/transition.transitionoptions.html#reload

Christian Ziegler
- 111
- 6