-
Notifications
You must be signed in to change notification settings - Fork 3k
Going to a state that has emptystring as its url doesn't change your address bar #705
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
Visiting states that don't have URLs does indeed not count as a browser-history-worthy event, but it seems to me that that is exactly how it's supposed to work. Did you expect something else? |
The state does have a url though. It's emptystring. When the page first loads, this is the route that ui-router matches and displays. I suppose you're saying emptystring is falsy and therefore a non-value, but that makes this behavior nonsensical. If it considers emptystring a matchable url during startup, it should consider it a url during later state changes too, for consistency. I've worked around this by setting up an automatic redirect to "/" and changing my url to "/". I'm sure this will by this similar issue. I just thought I'd bring up the fact that emptystring as a url is currently sort of broken, or at least inconsistent in its handling. |
Oh, I see...sorry for not understanding at first. What you're calling a workaround is what I always do and I've come not to think of it as a workaround . I use the "empty string state" as an abstract base state, and then I use it it to do some very basic templating and I use its resolve property to resolve promises for things that I want to have available at all times and prior to any real routing taking place -- for instance, in an app I'm working on now I make sure angular-translate's promise is resolved so I know the specified language files are loaded before the user sees anything. EDIT -- I realize I don't need to assign my abstract base state any URL at all, but I just do it anyway because I'm a creature of habit. :) |
If you want an "empty" url for a state, use "/". Otherwise this is the correct behavior. |
The state will change, you'll see the new template, but the address bar won't change! This screws up your history, since hitting back will take you back two steps.
The text was updated successfully, but these errors were encountered: