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
fix(router): router-link does not respect location strategy #4333
In particular, binding the HashLocationStrategy still makes router-link produce an href without the leading hash, which obviously does not work when copying or opening a link in another tab.
This is my first time looking at angular 2 source code. My analysis is as below. Please let me know if it is right.
The location_strategy.ts should expose a method generateNavigationUrl which should accept a string and return it as is (which is default implementation).
The hash_location_strategy.ts should override the generateNavigationUrl method and return the string with "#" + url passed.
The location.ts should expose a new method normalizedNavigationUrl which should accept a stringified instruction just like normalizeAbsolutely and internally call normalizeAbsolutely and pass that output to 'generateNavigationUrl' of the platformStrategy
Finally router_link.ts should be modified to use the new normalizedNavigationUrl instead of normalizeAbsolutely in the set routeParams method
Activity
whcmark commentedon Sep 23, 2015
So all href link should add hash?
router_link.ts
btford commentedon Sep 23, 2015
No, but apps where
HashLocationStrategyis used should generate links with hashes.rvramesh commentedon Sep 24, 2015
This is my first time looking at angular 2 source code. My analysis is as below. Please let me know if it is right.
The location_strategy.ts should expose a method
generateNavigationUrlwhich should accept a string and return it as is (which is default implementation).The hash_location_strategy.ts should override the
generateNavigationUrlmethod and return the string with "#" + url passed.The location.ts should expose a new method
normalizedNavigationUrlwhich should accept a stringified instruction just likenormalizeAbsolutelyand internally call normalizeAbsolutely and pass that output to 'generateNavigationUrl' of the platformStrategyFinally router_link.ts should be modified to use the new
normalizedNavigationUrlinstead ofnormalizeAbsolutelyin theset routeParamsmethodbtford commentedon Oct 9, 2015
@rvramesh – exactly right.
wip: fix(router): respect LocationStrategy when constructing url
fix(router): respect LocationStrategy when constructing hrefs in links
angular-automatic-lock-bot commentedon Sep 7, 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.