How to keep query parameters in angular 5 on all routes by default?

前端 未结 1 599
孤街浪徒
孤街浪徒 2021-02-02 00:14

Background:

The user calls the app\'s url with the parameters and uses my app. While switching between different routes the url parameters should be kept visible in the

相关标签:
1条回答
  • 2021-02-02 00:39

    Currently there is no way to set it globally. Using queryParamsHandling seems to be the only option:

    <a [routerLink]="['/login']" queryParamsHandling="preserve"></a>
    

    Or when using router:

    router.navigate('/login', { queryParamsHandling: "preserve" })
    

    The other possible option for queryParamsHandling is merge.

    0 讨论(0)
提交回复
热议问题