1.) let's suppose in our routing module we have a path configured like this:
{ path: 'version/:version/system/:system/id/:id' }
2.) in the browser we navigate to:
version/foo/system/bar/id/123
3.) in a component we want to change the URL to:
version/baz/system/bar/id/123
...the version changed...all other params are the same...
...we don't know how to achieve this (hopefully no string replacement :D ) with just changing the params of the router for example and appreciate any help or input...
some additional information:
this.route.params.subscribe(routeParams => {
this.routeParams = routeParams;
})
this.routeParams would be something like that
{version: 'foo',system: 'bar',id: '123'}
in my component i want to give version a new value like 'baz'
{version: 'baz',system: 'bar',id: '123'}
i know this would throw an error without creating a new object because this.routeParams is readonly...so i tried different things like
this.router.navigate([this.router.url], {version: 'baz',system: 'bar',id: '123'})
i can easily create a new URL string with the information i have but maybe there is a simple angular way i cant see :D