【发布时间】:2020-10-07 00:21:42
【问题描述】:
默认情况下,我希望浏览器在打开时导航到 LandingPageComponent。
当用户在斜线后输入时,我想导航到 ProfileComponent 并在 URL 中使用参数
这种方法可行吗?由于我收到“路径不能以斜杠开头”的错误。
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},
];
【问题讨论】:
标签: angular routes navigation frontend