Angular 默认路由器插座

Angular default router outlet

我有用户模块,我正在尝试加载默认路由器插座。 我想在路径为 /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)},];

要加载 UserHomeComponent,请更改此设置

{path: 'user' ,  component: UserComponent , children:[

来自

{path: '' ,  component: UserComponent , children:[