我在手动导航到根(默认)路由时遇到麻烦:
private router: Router,
//this works
this.router.navigate([{ outlets: { myoutlet: ['path2'] } }], {})
//this does not work
this.router.navigate([{ outlets: { myoutlet: [''] } }], {})
路由的定义如下:
const routes: Routes = [
{ path: '', component: Component1, outlet: "myoutlet", pathMatch: 'full' },
{ path: 'activities', component: Component2, outlet: "myoutlet" },
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})
如何导航回Component1?