Skip to content
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

Navigate to a relative URL #9

Open
mbinette opened this issue Apr 27, 2020 · 0 comments
Open

Navigate to a relative URL #9

mbinette opened this issue Apr 27, 2020 · 0 comments

Comments

@mbinette
Copy link

I'm not sure what the proper way is to navigate to a relative URL. I dispatch an event from a component and the page that acts on the event needs to change the URL. I can't use absolute paths because the page is used from more than one location.

Say I have https://myapp.com/page1/sec1 and an event is dispatched that is handled by page1 and needs to change to sec2.
I tried window.pushState({}, null, '../sec2'); but the router takes me back to my apps default route. I also tried ./sec2 and just sec2.

The only way I got it to work was to get a handle to the router-slot, call constructAbsolutePath('sec2') and then using the result in the pushState call. If that is what is needed, that is fine. Just wanted to know if there should be an easier way to navigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant