For me, this is the cleanest solution I managed to do. I hope it helps
import { Router } from '@angular/router';
constructor(private router: Router){}
getUrlWithoutParams(){
let urlTree = this.router.parseUrl(this.router.url);
urlTree.queryParams = {};
return urlTree.toString();
}