Dies kann mit der Router
Klasse archiviert werden:
eine Komponente verwenden:
import { Router, ActivatedRoute } from '@angular/router';
@Component({})
export class FooComponent {
constructor(
private _route: ActivatedRoute,
private _router: Router
){}
navigateToFoo(){
// changes the route without moving from the current view or
// triggering a navigation event
this._router.navigate([], {
relativeTo: this._route
queryParams: {
newOrdNum: '123'
},
queryParamsHandling: 'merge',
// preserve the existing query params in the route
skipLocationChange: true
// do not trigger navigation
});
}
}
Für weitere Informationen Check this book und der Winkel Router API
Sie wollen param wie https://example.com/newordnum/123? –
Mögliches Duplikat von [Warum HttpParams in angular 4.3 nicht in Mehrfachzeile funktioniert] (https://stackoverflow.com/questions/45459532/why-httpparams-doesnt-work-in-multiple-line-in-angular-4 -3) –
Ich möchte an vorhandene Parameter anhängen. Ich habe etwas wie dieses: example.com?param1=111 und jetzt möchte ich anhängen, um example.com?param1=111&newOrdNum=123 – None