Preserve angular paramater in absolute URL

  angular, angular2-routing

In my angular routing, I have a parameterized route :demo_name which precedes other child routes:

const routes: Routes = [
  {
    path: ':demo_name',
    children:
      [
        {
          path: 'somepath',
          [etc.]
        }
      ]
   }]

Accessing the route as an absolute path is no big deal:

<a routerLink="/ExampleDemo/somepath">Click to go</a>

However, How can I use absolute path and also preserve the parametized route? Note, using a relative URL is not an option as the components with routerlink can sit in various different locations.

<a routerLink="/**keep whatever current parameter here**/somepath">Click to go</a>

Source: Angular Questions

One Reply to “Preserve angular paramater in absolute URL”

  • Cannot read property ‘add’ of undefined
    at node_modules\@ngtools\webpack\src\ivy\plugin.js:164:86
    at Array.forEach ()
    at node_modules\@ngtools\webpack\src\ivy\plugin.js:164:33

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.