title: Change URL Path Parameter in Angular 2 Without Changing Active Route
body: <p>I'm trying to figure out a way to update a path parameter in my URL without changing the currently active route. For example, say I have the following routes:</p>
  
  <pre><code>{
      path: 'pages/:pageId',
      component: PageComponent,
      children: [
      {
          path: 'sections/:sectionId',
          component: PageSectionComponent,
          children: [
          {
              path: 'details',
              component: PageSectionDetailsComponent
          }]
      }]
  }
  </code></pre>
  
  <p>The problem I'm trying to solve is, when somebody changes the <code>:pageId</code>, I want to keep their active route while changing the URL. So if they change <code>:pageId</code> from 999 to 777, their route should change from:</p>
  
  <pre><code>pages/999/sections/123/details   =&gt;   pages/777/sections/123/details
  pages/999/sections/123           =&gt;   pages/777/sections/123
  </code></pre>
  
  <p>Additionally, I need to make this work for <code>:sectionId</code>. For example, navigating from <code>:sectionId</code> 123 to 456:</p>
  
  <pre><code>pages/999/sections/123/details   =&gt;   pages/999/sections/456/details
  pages/999/sections/123           =&gt;   pages/999/sections/456
  </code></pre>
  
  <p>There are several child routes in my project that I omitted, so absolute links would be very difficult to maintain. I'm hoping I can somehow use the current <code>ActivatedRoute</code>, change the single parameter I'm updating, then navigate to that route using the <code>Router</code>.</p>
  
  <p>Any help is greatly appreciated!</p>
  
  <p>Additional info:</p>
  
  <p><em>I'm using Angular 4.0.0</em></p>
  
  <p><em>There's a similar question that gets at the core problem I'm trying to solve, but it's out of date: <a href="https://stackoverflow.com/questions/35084169/change-a-single-route-parameter-on-the-current-route-in-angular-2">Change a single route parameter on the current route in Angular 2</a></em></p>