Can't access queryParams and fragments from canLoad
See original GitHub issueπ feature request
Relevant Package
This feature request is for @angular/routerDescription
#12411 and #17359 are still not solved, even though now the `canLoad` function possesses a `UrlSegment[]` argument. This argument enable us to access matrix parameters, but the query parameters and fragments of the destination url are still out of reach from inside of the `canLoad`functionDescribe the solution youβd like
Instead of a `UrlSegment[]` argument, what we need is a `UrlTree`Describe alternatives youβve considered
The only solutions available right now are still the same ones that have been given previously, and they are not satisfactory : either access the exact url from the `window` object (but there are lots of situation when the browser and router state are not in sync, like when using `skipLocationChange`) or give up on `canLoad` altogether and only use `canActivate` (but lose the benefit of lazyloading).Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Angular 2: how do I get route parameters from CanLoad ...
The problem that I'm having is that I can't get any route parameters if the state is being initialized from a different state...
Read more >Angular Basics: Getting Data From Fragments and Query ...
In this post, we are going to look into how you can retrieve data from URL query parameters in Angular inside the component...
Read more >Router tutorial: tour of heroes - Angular
However, you can use query parameters to get optional parameters available to all routes. Fragments refer to certain elements on the page identified...
Read more >Reloading Components when change in Route Params
Now let's say you want to open the details of another user, if you try and click the other one, it won't work....
Read more >Testing Angular route guards with the RouterTestingModule
When AuthGuard guards a CanLoad hook, access to route is rejected and its feature ... objectContaining({ queryParams: expectedQueryParamsΒ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One year later, and thereβs still no way to access query parameters in CanLoad, so itβs not possible to redirect the user to their intended destination url. π’
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.