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

feat(router): add hash-based navigation option to setUpLocationSync #28609

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@jasonaden
Copy link
Contributor

jasonaden commented Feb 8, 2019

The setUpLocationSync function in @angular/router/upgrade didn't previously let you sync hash-based navigations. With this change, you can now pass an option to setUpLocationSync that will make sure location changes run in Angular in hash-based apps.

Fixes #24429 #21995

@jasonaden jasonaden requested review from angular/fw-public-api as code owners Feb 8, 2019

@googlebot googlebot added the cla: yes label Feb 8, 2019

@@ -79,6 +79,30 @@ describe('setUpLocationSync', () => {
expect(RouterMock.navigateByUrl).toHaveBeenCalledWith(normalizedPathname + query + hash);
});

fit('should allow configuration tot work with hash-based routing', () => {

This comment has been minimized.

@IgorMinar

IgorMinar Feb 8, 2019

Member

oh no!!!!

@IgorMinar
Copy link
Member

IgorMinar left a comment

lgtm

@jasonaden jasonaden force-pushed the jasonaden:FW-241_location_sync_code branch from 05940ef to 7176dc3 Feb 8, 2019

@mhevery mhevery added the comp: router label Feb 8, 2019

@ngbot ngbot bot added this to the needsTriage milestone Feb 8, 2019

@jasonaden jasonaden force-pushed the jasonaden:FW-241_location_sync_code branch from 7176dc3 to 515ae50 Feb 13, 2019

@jasonaden

This comment has been minimized.

Copy link
Contributor Author

jasonaden commented Feb 14, 2019

jasonaden added some commits Feb 8, 2019

feat(router): add hash-based navigation option to setUpLocationSync
The `setUpLocationSync` function in @angular/router/upgrade didn't previously let you sync hash-based navigations. With this change, you can now pass an option to `setUpLocationSync` that will make sure location changes run in Angular in hash-based apps.

Fixes #24429 #21995

@jasonaden jasonaden force-pushed the jasonaden:FW-241_location_sync_code branch from 515ae50 to 3a58bcc Feb 19, 2019

IgorMinar added a commit that referenced this pull request Feb 20, 2019

feat(router): add hash-based navigation option to setUpLocationSync (#…
…28609)

The `setUpLocationSync` function in @angular/router/upgrade didn't previously let you sync hash-based navigations. With this change, you can now pass an option to `setUpLocationSync` that will make sure location changes run in Angular in hash-based apps.

Fixes #24429 #21995

PR Close #28609

@IgorMinar IgorMinar closed this in 71d0eeb Feb 20, 2019

@@ -58,7 +58,7 @@ export function locationSyncBootstrapListener(ngUpgrade: UpgradeModule) {
*
* @publicApi
*/
export function setUpLocationSync(ngUpgrade: UpgradeModule) {
export function setUpLocationSync(ngUpgrade: UpgradeModule, urlType: 'path' | 'hash' = 'path') {

This comment has been minimized.

@gkalpak

gkalpak Feb 20, 2019

Member

No API docs? 😱 😱 😱

const hashIdx = next.indexOf('#');
url = resolveUrl(next.substring(0, hashIdx) + next.substring(hashIdx + 1));
} else {
throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;

This comment has been minimized.

@gkalpak

gkalpak Feb 20, 2019

Member

It is better to throw Errors instead of strings 🤔

IgorMinar added a commit that referenced this pull request Feb 20, 2019

Revert "feat(router): add hash-based navigation option to setUpLocati…
…onSync (#28609)"

This reverts commit fc895ba.

This is change is a feature and doesn't belong on the patch branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
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.