具有相同组件的Angular(v6)递归路由

时间:2019-02-18 02:06:04

标签: angular typescript routing

我有一个使用Angular 6开发的应用程序,该应用程序使用嵌套组件。同一条路线可以重复任何次数。

要求: 组件“作业”可以具有任意数量的子作业。因此,我需要能够导航到以下子作业:作业1>作业2>作业3 ...等。

问题: 我无法使路由起作用,以便能够使此递归结构正常运行。

路由配置:

const routes: Routes = [ { path: '', component: LayoutComponent, children: [ { path: 'jobs/:id', data: { breadcrumbs: '{{ job.text }}' }, component: JobComponent, resolve: { job: JobResolver }, children: [ { path: '**', component: JobComponent, resolve: { job: JobResolver }, children: [ { path: '', pathMatch: 'full', component: JobDetailsComponent }, { path: 'folders/:folder_id', data: { breadcrumbs: '{{folder.text}}' }, component: FolderComponent, resolve: { folder: FolderResolver }, children: [ { path: '**', pathMatch: 'full', component: FolderDetailsComponent, } ] } ] } ] } ] } ];

是否可以导航到http://localhost:4000/home/jobs/1/jobs/2/jobs/3/folders/10/folders/11

0 个答案:

没有答案