Skip to content

Instantly share code, notes, and snippets.

@jagomf
Created October 23, 2018 14:17
Show Gist options
  • Save jagomf/6d161697cab59df6018146a7477b8dfa to your computer and use it in GitHub Desktop.
Save jagomf/6d161697cab59df6018146a7477b8dfa to your computer and use it in GitHub Desktop.
Angular: Append a query parameter to current route without navigating
import { ActivatedRoute, Router, NavigationExtras } from '@angular/router';
...
const extras: NavigationExtras = {
relativeTo: this.route,
queryParams: { name: value },
queryParamsHandling: 'merge'
};
this.router.navigate([], extras).then(() => { /* continue here */ });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment