我有一个称为main
此处main.routing.ts
定义的组件:
@NgModule({
imports: [
RouterModule.forRoot([
{ path: 'main',
component: MainComponent,
canActivate: [AuthGuard],
children: [{ path: '', component: AccountMainComponent },
{ path: 'financial-accounts', component: FinancialAccountsComponent },
{ path: 'system-config', component: ConfigSysComponent },
{ path: 'conciliacao', component: ConciliacaoContabilComponent },
{ path: 'report', component: ReportComponent },
]}
])
]
})
export class MainRouting { }
而且我还有另一个content-toolbar
组件,我想在其中创建指向main
组件的链接。在 content-和 at 处content-toolbar
导入。我有这段代码:router
toolbar.module.ts
content-toolbar.component.ts
content-toolbar.component.html
<span>
<a routerLink="/main">
<img src="/assets/icons/logo_white.svg" class="logo">
</a>
</span>
但是此代码不会将此图像转换为指向其他组件的链接。我应该如何将main
组件引用为路由器(ed)到 from content-toolbar
?