0
我的文件夾結構,如:如何loadChildren異步與角路由器裝載機
- app
-core
-vacancy
在core
文件夾我有app.routing.ts
,我想異步添加路由空缺。
我做到了像:
export const routing = RouterModule.forRoot([
{
path: '',
component: HomeComponent,
canActivate: [AuthGuard]
},
{
path: 'vacancy',
loadChildren: '../vacancy#VacancyModule'
},
{
path: '**',
component: NotFoundComponent
}
], {useHash: true}
);
我得到一個錯誤:
Can't resolve '..\vacancy'
dispite事實存在的文件夾空缺文件夾app
和空缺的裏邊有一個文件vacancy.module.ts
這`外觀像:
// some imports here
@NgModule({
declarations: [
VacancyBaseComponent
],
imports: [
CommonModule,
FormsModule,
RouterModule.forChild(routes),
],
})
export class VacancyModule {
public static routes = routes;
}
任何想法我做錯了什麼?