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
{{ message }}
Repository navigation
Missing path rewrite after redirects when using HashLocationStrategy #12438
Current behavior
When using HashLocationStrategy and changing directly to a path that has redirectTo, the redirects are correctly handled (the correct component is loaded), but the path after the hash is not rewritten in accordance with the final route reached after redirecting.
By contrast, the path is rewritten when navigating a routerLink anchor or in all cases when using PathLocationStrategy.
Expected behavior
The path after the hash should always reflect the route reached after following all redirects.
Minimal reproduction of the problem with instructions
See this plunkr. Open the preview in a separate window (you may want to cut and paste the plunkr URL to a real browser tab where you can edit it).
Copy the URL of the To Section anchor and paste it in the address bar: the correct component is loaded, but the path remains /section instead of being rewritten to /section/initial.
If you click the To Section anchor, the path is instead rewritten correctly.
What is the motivation / use case for changing the behavior?
Consistency of behavior with the path strategy and with links when clicked.
Also, rewriting to the final location may be important for SEO.
is this still an issue? Can't reproduce using your description:
Copy the URL of the To Section anchor and paste it in the address bar: the correct component is loaded, but the path remains /section instead of being rewritten to /section/initial.
@DzmitryShylovich @popalexandruvasile I am still able to reproduce the bug (with Angular 2.3.1).
You are probably doing the wrong steps (sorry, my bad!).
Click the Launch the preview in a separate window button (blue X). A new browser window opens to an URL like https://run.plnkr.co/RANDOM_CHARS/#/.
In Chrome, the window that opens has a read-only location textbox. Since manually changing the location is essential for reproducing the bug, copy the URL (https://run.plnkr.co/RANDOM_CHARS/#/) and paste it in a regular browser tab.
In the new browser tab, with the home component loaded, copy to the URL of the To Section anchor and paste it in the address bar, replacing the URL of the home component. To reiterate, the URL should change from https://run.plnkr.co/RANDOM_CHARS/#/ to https://run.plnkr.co/RANDOM_CHARS/#/section.
If you prefer, you can manually type section after /#/ and hit Return.
The app will correctly switch to SectionInitialComponent, whose path is section/initial, but the location box will still show https://run.plnkr.co/RANDOM_CHARS/#/section instead of https://run.plnkr.co/RANDOM_CHARS/#/section/initial.
Activity
DzmitryShylovich commentedon Dec 4, 2016
is this still an issue? Can't reproduce using your description:
alexpopdev commentedon Dec 4, 2016
It seems like it is fixed in Angular 2.2.
lorenzodallavecchia commentedon Dec 19, 2016
@DzmitryShylovich @popalexandruvasile I am still able to reproduce the bug (with Angular 2.3.1).
You are probably doing the wrong steps (sorry, my bad!).
Here's what I am doing, step by step:
https://run.plnkr.co/RANDOM_CHARS/#/.https://run.plnkr.co/RANDOM_CHARS/#/) and paste it in a regular browser tab.https://run.plnkr.co/RANDOM_CHARS/#/tohttps://run.plnkr.co/RANDOM_CHARS/#/section.If you prefer, you can manually type
sectionafter/#/and hit Return.SectionInitialComponent, whose path issection/initial, but the location box will still showhttps://run.plnkr.co/RANDOM_CHARS/#/sectioninstead ofhttps://run.plnkr.co/RANDOM_CHARS/#/section/initial.DzmitryShylovich commentedon Dec 19, 2016
@lorenzodallavecchia now i see, thx. Yeah, the issue is still persist.
I believe it will be fixed here #13545
DzmitryShylovich commentedon Dec 21, 2016
@lorenzodallavecchia #13545 was merged. could u pls try it out if it fixes your issue when it will be available?
lorenzodallavecchia commentedon Dec 22, 2016
@DzmitryShylovich I have just tested with 4.0.0-beta.1 and the bug appears to be fixed.
DzmitryShylovich commentedon Dec 22, 2016
👍
DzmitryShylovich commentedon Dec 22, 2016
@lorenzodallavecchia could u close the issue pls? thx
angular-automatic-lock-bot commentedon Sep 10, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.