-
Notifications
You must be signed in to change notification settings - Fork 3k
[ui-sref] Reload current state with parameter - not tracking current state? #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Found my issue..
Which is what was causing my problem. Using the below is working for me...
|
@MathewWoodhall what version are you using? See #3139 and #1031 (comment) In legacy branch (0.3.2) there's code to use the current state but it is only processed once, when the So, in 0.3.2, the link gets |
I found this issue because I wanted to do a similar thing: Change a language state param, but stay in the same state (where same means current, i.e. it can change after the page header has been loaded).
The solution suggested by @MathewWoodhall did the trick! |
Hi,
I have an app that has a location setting. When a different location is clicked the app should reload the current state with the new location as a parameter. I'm trying to do this through the ui-sref directive, rather than $state.go, so the hrefs remain in the html.
Here's my ui-sref..
<a ui-sref="{location: 'UK'}">UK</a>
and the generated html..
<a ui-sref="{location: 'UK'}" href="#/UK/home">UK</a>
This works fine initially, but when I navigate to a different state and then change the location - the app jumps back to the homepage. As if ui-router isn't tracking what the current state is in ui-sref.
Is my implementation of 'ui-sref="{location: 'UK'}"' at fault?
The generated href also doesn't update when I navigate to a different state, but I don't know if this is intentional.
The text was updated successfully, but these errors were encountered: