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

Router navigateByUrl documentation does not indicate that it ignores queryParams #22611

Closed
Jaarx opened this issue Mar 6, 2018 · 3 comments
Closed

Comments

@Jaarx
Copy link

Jaarx commented Mar 6, 2018

https://angular.io/api/router/Router#navigateByUrl

The above documentation gives no indication that it ignores the queryParams NavigationExtras value. There should be something that explicitly mentions NavigationExtras that do nothing.

@ngbot ngbot bot added this to the needsTriage milestone Mar 6, 2018
@jasonaden
Copy link
Contributor

queryParams is used when creating the target URL, as well as when using queryParamsHandling strategy of merge, as well as returned as the default for routerLinks.

Please file a new issue if there's a specific thing missing from the documentation.

@Jaarx
Copy link
Author

Jaarx commented Mar 7, 2018

That seems wrong if we parse through the code:

navigateByUrl itself at first only uses the URL as provided from the function call: https://github.com/angular/angular/blob/master/packages/router/src/router.ts#L452

When it goes to scheduleNavigation, the extras is passed along but nothing is done in scheduleNavigation with extras except passed to this.navigations.next(...): https://github.com/angular/angular/blob/master/packages/router/src/router.ts#L567

this.navigations is processed here: https://github.com/angular/angular/blob/master/packages/router/src/router.ts#L518

which calls executeScheduledNavigation: https://github.com/angular/angular/blob/master/packages/router/src/router.ts#L574

Notably at this point the only values from extras that this cares about is skipLocationChange and replaceUrl: https://github.com/angular/angular/blob/master/packages/router/src/router.ts#L586

TL;DR at no point does a navigateByUrl extract any queryParams from the NavigationExtras

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants