Angular2-router: How to only change a parameter of a route?
<p>I want to have the following routes in my application:</p>

<pre><code>export const routes: Routes = [
    { 
       path: ':universityId', 
       component: UniversityComponent,
       children: [
           { path: 'info', component: UniversityInfoComponent },
           { path: 'courses/:status', component: CoursesByStatusComponent }
       ]
    }
]
</code></pre>

<p>Being on <code>/1/info</code> or <code>/1/courses/open</code> url, how do I change <code>:universityId</code> only from <code>UniversityComponent</code>?</p>

<p>Simple <code>router.navigate(['../', 2], {relativeTo: currentRoute })</code> won't do because it redirects to <code>/2</code>, losing all other information. Using <code>'../2/courses/open</code> is also not an option - I can be on any child route at that moment.
Best I could come up with is:</p>

<pre><code>const urlTree = this.router.parseUrl(this.router.url);
urlTree.root.children['primary'].segments[0].path = '2';
this.router.navigateByUrl(urlTree);
</code></pre>

<p>but it's kind of ugly</p>