Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Use Angular Router’s queryParamsHandling to decide what happens to query parameters when you build a destination URL: choose 'merge' to combine new values with the current query string, 'preserve' to keep the current values and ignore new ones, or 'replace' to use only the new values. Without a per-navigation setting or configured fallback, Angular replaces the query string.
Choose the right query-parameter strategy
The setting accepts 'merge', 'preserve', 'replace', or the empty string ''. Angular documents '' as a legacy synonym for 'replace'; use the explicit spelling in new code. See the Angular QueryParamsHandling API reference.
| Value | What happens | Typical use |
|---|---|---|
merge |
Combines supplied parameters with the current query parameters. For a key present in both, the supplied value wins. | Add or update a filter, sort order, or page number without dropping unrelated URL state. |
preserve |
Keeps current query parameters unchanged and discards any new parameters supplied for that navigation. | Navigate to another route while carrying the existing query state as-is. |
replace |
Replaces the current query string with the supplied parameters. | Ensure the destination has only the query state explicitly specified for it. |
'' |
Behaves like 'replace'. |
Legacy compatibility; prefer 'replace' in new code. |
These behaviors are documented in Angular’s NavigationExtras API reference. The key distinction is that merge accepts supplied values and resolves collisions in their favor, whereas preserve ignores supplied values entirely.
Use queryParamsHandling in a RouterLink
Bind queryParams to the values you want to add or update, then set queryParamsHandling to merge:
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
<a [routerLink]="['/products']"
[queryParams]="{ category: 'books' }"
queryParamsHandling="merge">
Books
</a>
If the current URL is /products?sort=price&page=2, this link adds or updates category while retaining the other query parameters. Angular documents queryParamsHandling as a RouterLink input; consult the RouterLink API reference.
To carry the current query parameters unchanged instead, use queryParamsHandling="preserve". Any values also passed through [queryParams] are discarded under that strategy.
Rank #2
Set the strategy for Router.navigate
For imperative navigation, pass the setting in the navigation extras object:
this.router.navigate(['/results'], {
queryParams: { page: 2 },
queryParamsHandling: 'merge',
});
This adds or updates page while retaining other current query parameters; if page already exists, the supplied value takes precedence. To preserve the current query string without applying supplied parameters, use queryParamsHandling: 'preserve'. For a fresh query string containing only the explicitly supplied values, use 'replace' or omit the setting when no configured fallback applies.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #3
Configure an application-wide URL-creation fallback
If URL creation should merge query parameters by default, configure the router with withRouterConfig:
provideRouter(
routes,
withRouterConfig({ defaultQueryParamsHandling: 'merge' }),
);
defaultQueryParamsHandling is a fallback for Router.createUrlTree and APIs that use it when no strategy is specified for the individual URL creation. It can suit search or filter flows where new parameters should normally retain existing URL state. An explicit per-navigation strategy lets a particular navigation use a different behavior. Angular describes the configuration in its RouterConfigOptions API reference and customizing route behavior guide.
Rank #4
This fallback does not apply to Router.navigateByUrl. If you use that method, do not assume the configured default will govern its URL.
Quick Recap
Quick decision guide
- Adding or changing one query value while retaining the rest: use
merge. - Carrying the existing query string unchanged and ignoring new query values: use
preserve. - Replacing existing query state with explicitly supplied values: use
replace. - Making URL-tree creation merge by default: configure
defaultQueryParamsHandling: 'merge', while accounting for thenavigateByUrlexception.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

