-
Notifications
You must be signed in to change notification settings - Fork 3k
feat($state): support URLs with #fragments #1867
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
Conversation
Allow setting the `#` param to update the location fragment; e.g.: `ui-sref="page({name: 'name', '#': 'frag'})"` or `$state.go('page', {name: 'name', '#': 'frag'})`
Patch looks good. 👍 I'll just wait for Travis to do its thing. |
feat($state): support URLs with #fragments
Hi there, Any idea when we can expect release version with this update? |
Looks like it's in 0.2.14 now :) Thanks ui-router team! |
to get hash fragment support: angular-ui/ui-router#1867
It doesn't seem to work for me. This is the anchor: And this is the link: Do I have to change something else? |
@kikar You forgot the <a ui-sref="public.home({ '#': 'pricing' })">PRICING</a> |
@nateabele Still not working, goes to right page, but doesn't scroll to anchor nor changes the url. |
@nateabele @kikar Same here. Goes to the right page but does not jump to the anchor. |
Not sure. Can you open a new issue with a link to a plunkr that demonstrates the issue? Thanks. |
Not working for me either, goes to correct page with correct fragment but does not jump to anchor.
|
@nateabele - #1961 was (wrongly) closed as a duplicate of #701, and has a Plunkr demonstrating this exact issue in version 0.2.14: |
Same problem here. |
Guys, I think it is not going to work the way you expect. As far as I understand router code, the ui-sref transitions to new state on click, which usually means load new view or subview and run associated controller. It does not handle scrolling for you (except for autoscroll to view mentioned below). I believe you need to scroll to the given element yourself using something like https://docs.angularjs.org/api/ng/service/$anchorScroll Things to consider:
Good luck |
Does anyone know how to get this working with smooth scrolling please? |
Thank you! |
Let's say you have a link on Page A in the common footer of the page:
You then click on that link to take you to Page B This works fine when the argument |
For me it doesn't work, I have te same problem who lookfirst, the first time it go to the Page B but don't scroll and if you reload the browser, or go back and press the link again it work good. I wait new comments and if someone can find a solution. Thanks in advance |
Allow setting the
#
param to update the location fragment; e.g.:ui-sref="page({name: 'name', '#': 'frag'})"
or$state.go('page', {name: 'name', '#': 'frag'})
Improving upon #1855