Reference Information:
The user calls the application URL with parameters and uses my application. When switching between different routes, URL parameters should be stored in the address bar of the browser.
I need to save request parameters for each route of my application. That means if I have url
www.example.com/app/test?id=326748798342&state=1
and call the link with [routerLink]="['/login']"
I need to get this URL:
www.example.com/app/login?id=326748798342&state=1
.
By default, I get an entry route with no parameters. I found one solution that says to install queryParamsHandling='merge'
. But this is a very bad decision, because it would mean changing all the links in the templates and all calls to navigate ().
Is there a cleaner way to solve this problem by default? Something like setting queryParamsHandling in an array of routes for the application, or something else?
source
share