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:
I was looking for answer like this when I wanted to remove access_token parameter from url. If you just want remove one parameter and retain the other parameters.
setTimeout(() => {
let urlWithoutAccessToken = this.router.url.replace(new RegExp('.access_token=' + idToken), '');
this.router.navigateByUrl(urlWithoutAccessToken);
}, 0);
The setTimeout was needed for some reason, the navigateByUrl didn't work without it.