Search code examples
angular10angular11

angular 11 router.navigateByUrl abd qyeryparams


Working with Angular 10 this was valid

this.router.navigateByUrl(targetUrl, {
            queryParams: {
                token: accessToken
            }
        });

Now (Angular 11) queryParams is not supported anymore what can I do to get the same functionality


Solution

  •  this.router.navigate([url], {
                    relativeTo: this.route,
                    queryParams: {token: accessToken},
                  });
    

    Try with this code snippet