Angular erasing all query parameters

后端 未结 4 1949
失恋的感觉
失恋的感觉 2021-01-07 04:00

Related to but not a duplicate of: How to keep query string parameters in URL when accessing a route of an Angular 2 app?

I have a very basic Angular app, and when I

4条回答
  •  感动是毒
    2021-01-07 04:37

    if you want to retrieve query paramaters, then it is done using queryParam/queryParamMap..

    this.route.queryParamMap.subscribe(params => {
       console.log(params);
    });
    

    You may need to preserve the query parameters, or merge them as stated here.

    https://angular.io/api/router/NavigationExtras

    v4

    preserveQueryParams: true
    

    v5

    queryParamsHandling: 'preserve'
    

提交回复
热议问题