0

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.

0

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.