Monday, March 26, 2018

How do I shake off the current folder when navigating away with Angular's routing?

When this...

<ol>
   <li><a [routerLink]="['./','baz']">Baz</a></li>
   <li><a [routerLink]="['./','qux']">Qux</a></li>
</ol>

 
 

...ends up causing a console error suggesting that a path to /foo/bar/qux/baz or /foo/bar/baz/qux is illegit, try this instead...

<ol>
   <li><a [routerLink]="['/foo/bar','baz']">Baz</a></li>
   <li><a [routerLink]="['/foo/bar','qux']">Qux</a></li>
</ol>

 
 

...which should give the desired paths to /foo/bar/baz and /foo/bar/qux

No comments:

Post a Comment