【发布时间】:2018-02-10 04:05:05
【问题描述】:
在我的路由中,创建了子组件,我可以在路由器插座中看到默认子路由。但是当导航到其他子路由时,显示错误“无法匹配任何路由”。
routing.ts
const appRoutes: Routes = [
{
path: '',
component: HomeComponent
},
{
path: 'dashboard',
pathMatch: 'full',
component: DashboardComponent,
canActivate: [AuthGuard],
children: [
{
path: '',
pathMatch: 'full',
component: DashboardhomeComponent
} ,
{
path: 'profile',
pathMatch: 'full',
component: ProfileComponent
}
]
},
{
path: 'login',
component: LoginComponent
},
];
dashboard.ts
goto() {
this.router.navigate(['dashboard/profile']);
}
【问题讨论】: