Remove a parameter from queryParams angular 2

前端 未结 9 1479
半阙折子戏
半阙折子戏 2021-01-31 09:42

I navigate to a certain page in my app with a query parameter. After I get the parameter from the URL I want to delete it, ideally I would have this:



        
9条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 10:39

    I use the router method navigateByUrl.

    Alternate doc: Angular documentation

    Keep in mind that the path you feed it is treated as absolute. You cannot use relative component routing with this method.

    My use is I have a component that serves as an external callback for auth events, such as resetting the password and email validation. Once the operation is complete, any navigation action needs to occur happens through router.navigateByUrl(path)

提交回复
热议问题