Cela pourrait être archivé en utilisant la Router
classe:
L'utilisation d'un composant:
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
});
}
}
Pour plus d'informations check this book et l'angle Router API
Vous voulez param comme https://example.com/newordnum/123? –
Copie possible de [Pourquoi HttpParams ne fonctionne pas sur plusieurs lignes en 4.3 angulaire] (https://stackoverflow.com/questions/45459532/why-httpparams-doesnt-work-in-multiple-line-in-angular-4 -3) –
Je veux ajouter sur les paramètres existants. J'ai quelque chose comme ceci: exemple.com?param1=111 et maintenant je veux ajouter à get.com exemple.com?param1=111&newOrdNum=123 – None