Angular2 - 是否使用不再支持的导出常量的子路由?

时间:2016-12-23 20:15:06

标签: angular angular2-routing

使用Angular 2.2.3,我有一个像这样的文件夹/文件结构:

/proposals
index.ts <- exports everything inside '/proposals'
proposals.routes.ts

/proposals/proposal-document/ProposalDocumentComponent.ts
/proposals/component2
/proposals/component3 etc.

proposals.routes.ts的内容:

import { Routes } from '@angular/router';

import { ProposalDocumentComponent } from './';

export const PROPOSAL_ROUTES: Routes = [
  { path: ':id/document', component: ProposalDocumentComponent }
]

在我app-routing.module.ts内部我导入常量并使用它:

import { PROPOSAL_ROUTES } from './proposals';

const routes: Routes = [
...lots of routes..
{ path: 'proposals', component: ProposalsComponent, children: PROPOSAL_ROUTES },
]

这会引发错误“错误:未激活插座”

这是否不再受支持?

0 个答案:

没有答案