Angular 8 路由,无法导航到斜杠前没有名称的组件
Angular 8 routing, cant navigate to component without a name before slash
默认情况下,我希望浏览器在打开时导航到 LandingPageComponent。
当用户在斜杠后输入时,我想使用 URL
中的参数导航到 ProfileComponent
这种方法可行吗?因为我得到 "Path cannot start with a slash".
的错误
app-routing.module.ts
const routes: Routes = [
{path:'', component:LandingPageComponent},
{path: '/:profileId',
loadChildren: './profile/profile.module#profileModule'
},
];
profile-routing.module.ts
const routes: Routes = [
{path:'', component:profileComponent}, //< I want to load this component after /user1
{path :'folder/:folderId', component:FolderComponent},
];
应用-routing.module.ts
const routes: Routes = [
{path:'', component:LandingPageComponent},
{path: ':profileId',
loadChildren: './profile/profile.module#profileModule'
},
];
从 profileId 的路径中删除“/”并尝试。
默认情况下,我希望浏览器在打开时导航到 LandingPageComponent。
当用户在斜杠后输入时,我想使用 URL
中的参数导航到 ProfileComponent这种方法可行吗?因为我得到 "Path cannot start with a slash".
的错误app-routing.module.ts
const routes: Routes = [
{path:'', component:LandingPageComponent},
{path: '/:profileId',
loadChildren: './profile/profile.module#profileModule'
},
];
profile-routing.module.ts
const routes: Routes = [
{path:'', component:profileComponent}, //< I want to load this component after /user1
{path :'folder/:folderId', component:FolderComponent},
];
应用-routing.module.ts
const routes: Routes = [
{path:'', component:LandingPageComponent},
{path: ':profileId',
loadChildren: './profile/profile.module#profileModule'
},
];
从 profileId 的路径中删除“/”并尝试。