【发布时间】:2020-03-28 15:31:59
【问题描述】:
我有用户模块,我正在尝试加载默认路由器插座。 当路径为 /user 但它不起作用时,我想加载 UserHomeComponent 。如果我添加路径而不是将其保持为空,则它可以正常工作。 这是我的用户路由模块:
const routes:Routes = [
{path: 'user' , component: UserComponent , children:[
{path: '' , component: UserHomeComponent},
{path: 'new-request' , component: NewRequestComponent},
{path: 'checkout' , component: CheckoutComponent},
{path: 'edit-info' , component: UserEditInfoComponent},
{path: 'requests', component: UserRequestsComponent},
{path: 'change-password' , component: UserChangePasswordComponent},
{path: 'delete-account' , component: DeleteAccountComponent}
]}
]
这是我的应用路由模块:
const appRoutes:Routes = [
{path: '' , redirectTo: 'login' , pathMatch: 'full'},
{path: 'login' , component: LoginComponent },
{path: 'signup' , component: SignupComponent},
{path: 'user' , loadChildren: () => import('./user/user.module').then(m => m.userModule)},];
【问题讨论】:
-
请定义“它不工作”。你看到了什么错误?
标签: angular path default router outlet