Closed why520crazy closed 1 year ago
使用 redirectToRoute('dashboard') 函数代替之前的:
redirectToRoute('dashboard')
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
使用方式如下:
export const routers: Route[] = [ { path: 'app1', component: AppActualRootComponent, children: [ // { // path: '', // redirectTo: 'dashboard', // pathMatch: 'full' // }, redirectToRoute('dashboard'), { path: 'dashboard', component: DashboardComponent } ... ];
redirectToRoute 函数会生成一个默认空路由,组件自动跳转到相对路由:
export function redirectToRoute(redirectTo: string): Route { return { path: '', component: RedirectToRouteComponent, data: { redirectTo: redirectTo } }; }
使用
redirectToRoute('dashboard')
函数代替之前的:使用方式如下:
redirectToRoute 函数会生成一个默认空路由,组件自动跳转到相对路由: