2

I have a route /a with some parameters (such as /a;foo=1;bar=2/) and two sub-routes: /a/x and a/y.

Component responsible for route a fiddles with parameters foo and bar and changes them depending on the user input. It also updates the parameters in the route, as shown above.

Can I update route parameters without changing sub-routes (or manually having to read them and re-apply them)?

This is how I navigate through code, if I know the sub-route (x or y):

this.router.navigate(['/a', params, 'x']);
// or
this.router.navigate(['/a', params, 'y']);

I hope for a method along the lines of the following:

this.router.navigate(['/a', params, /* don't change */])

If I completely leave out the last element of the array (x/y), it just always gets redirected to x since that's the default route.

Versions: core 2.0.0-rc.5 and router 3.0.0-rc.1

Lazar Ljubenović
  • 18,976
  • 10
  • 56
  • 91
  • Sounds similar to https://github.com/angular/angular/issues/8956, https://github.com/angular/angular/issues/7378 I think to remember that there was another issue that fits better to your requirment but I couldn't find it. I guess you have to traverse the router tree and rebuild a new route where the parameters that should change are replaced. I don't think there is something available out of the box. – Günter Zöchbauer Sep 06 '16 at 11:30

0 Answers0