2016-12-08 134 views
0

鑑於此路由配置:導航輔助路線拋出異常

export const ROUTES: Route[] = [ 
     { path: '', redirectTo: 'projects', pathMatch: 'full' }, 
     { path: 'projects', component: ProjectsComponent, 
     children: [ 
      { path: 'projectlist', component: ProjectListComponent, outlet: 'sidemenu' } 
     ] 
     } 
    ]; 

調用

this.router.navigate(['projects(sidemenu:projectlist)']); 

拋出

error_handler.js:47 EXCEPTION: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'projects(sidemenu%3Aprojectlist)'

+0

嘗試在項目後添加「/」 - projects /(sidemenu:projectlist) –

回答

0

此設置工作。更清潔,但不確定是否傳統。

export const ROUTES: Route[] = [ 
    { path: '', redirectTo: 'projects', pathMatch: 'full' }, 
    { path: 'projects', 
    children: [ 
     { path: '', component: ProjectsComponent }, 
     { path: '', component: ProjectListComponent, outlet: 'sidemenu' } 
    ] 
    } 
];