I don’t think there is a way to define that in the routes configuration.
Currently it is supported for routerLink
s and imperative navigation to enable
You can add a guard to the empty path route, where in the guard navigation to the /comp1
route is done.
router.navigate(['/comp1'], { preserveQueryParams: true }); //deprecated. see update note
router.navigate(['/comp1'], { queryParamsHandling: "merge" });
There is a PR to allow to configure preserveQueryParams
globally.
Update note: from https://angular.io/api/router/NavigationExtras, preserveQueryParams is deprecated, use queryParamsHandling instead