angular-ui / ui-router

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

Modify URL without state reload #3470

Closed inad9300 closed 4 years ago

inad9300 commented 7 years ago

This is a feature request.

reloadOnSearch is deprecated. Now we are supposed to use "dynamic parameters" -- a much more obscure name than "reload on search". The reasons for this change are beyond my understanding, but both approaches are too rigid.

Once you say "do not reload x state if a parameter changes", you are completely restricted on what you can do. No doubt you will at some point need to add a new parameter for which you do want to reload the state if it changes.

Once you say "do not reload whatever state if x parameter changes", you are equally restricted. No doubt you will sooner or later want to both, in different circumstances, navigate to the state with new parameters, and simply synchronize some internal state with the URL.

So, in my opinion, the ideal approach would be to allow controlling the reload on a per-call basis, i.e. via a parameter on the go() function.

If you find the time to implement such a feature, I would be very grateful.

ventralnet commented 7 years ago

This would be useful as well if you are in the situation where you want a parameter to be dynamic for one child state, yet non dynamic for other sibling states

sarod commented 7 years ago

Looks like a duplicate of #2679

inad9300 commented 7 years ago

It might well be, although they refer to very specific use cases and start to bring weird terms, such as "dynamic parameters" and "sticky states". The need is to modify the URL, it cannot be simpler. Anyways, focusing on the original message, @orangesoup's problem could definitely be solved with an extra parameter in the go() function, as it was (kind of) possible with the old UI Router.

Feel free to close this issue in favour of #2679, but please, don't overcomplicate things!

ventralnet commented 7 years ago

Is there a way to use one of the transition service hooks to stop a state transition but still perform the URL updating?

inad9300 commented 7 years ago

That is an interesting idea, but still overcomplicated in my view. I'm not sure if it is even possible, though.

inad9300 commented 7 years ago

Any news on this (or #2679)?

By stopping to use the deprecated reloadOnSearch() I start to see duplicated requests all around my application. Using dynamic parameters is not convenient at all for me either -- not because of the reasons I exposed at first, which I believe are enough on themselves, but also because all my states are defined with your syntax ?{paramName:paramPattern}, which does not support specifying the parameters as dynamic, and changing this everywhere is too much work. It's turning into a maintenance nightmare.

inad9300 commented 6 years ago

Sorry for being so insistent, but are there any updates on this...? Are you planning on implementing a feature like this?

inad9300 commented 6 years ago

Pop.

MartijnWelker commented 6 years ago

@inad9300 @ventralnet I might have created a solution that fits your needs over in #3047

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.