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)
}
使用下面的代码
[routerLink]="['home/1057/view/sidebar:view']"
Try like this
<a [routerLink]="['url path']">
Below Snipped solved the problem.
<a routerLinkActive="active"
[routerLink]="['home/1057/view',
{ outlets: { 'sidebar': ['view'] } }]" >{{ name }}</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.