You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 bypage1
and needs to change tosec2
.I tried
window.pushState({}, null, '../sec2');
but the router takes me back to my apps default route. I also tried./sec2
and justsec2
.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.The text was updated successfully, but these errors were encountered: