I have a below route defined in my angular 12 app, I am able to navigate to it directly using the browser URL bar. Now I am trying to navigate using hyperlink, like below
<a routerLink="home/1057/view/(sidebar:view)">sidebar</a> <!-- Doesn't work -->
or
<a routerLink="/home/1057/view/(sidebar:view)">sidebar</a> <!-- Doesn't work -->
http://localhost/home/1057/view(sidebar:view) - works fine when you directly hit the url, but above
routerLink
is not working, any ideas ?
{
path: 'view',
outlet: 'sidebar', // right
loadChildren: () => import('src/app/entities/sidebar/sidebar.module').then(m => m.SideBarModule)
}
CodePudding user response:
Try like this
<a [routerLink]="['url path']">
CodePudding user response:
Use the below code
[routerLink]="['home/1057/view/sidebar:view']"
CodePudding user response:
Below Snipped solved the problem.
<a routerLinkActive="active"
[routerLink]="['home/1057/view',
{ outlets: { 'sidebar': ['view'] } }]" >{{ name }}</a>