Angular 离子4/角度布线:错误:未捕获(承诺中):错误:找不到';EventHomePageModule';在';中/home/home.module';
我正在试验昨天发布的Ionic 4 Beta 15 这是我的Angular 离子4/角度布线:错误:未捕获(承诺中):错误:找不到';EventHomePageModule';在';中/home/home.module';,angular,angular2-routing,lazy-loading,ionic4,Angular,Angular2 Routing,Lazy Loading,Ionic4,我正在试验昨天发布的Ionic 4 Beta 15 这是我的批准模块 const routes: Routes = [{ path : '', loadChildren : './tabs/tabs.module#TabsPageModule' /* }, { path : 'event/:id',
批准模块
const routes: Routes = [{
path : '',
loadChildren : './tabs/tabs.module#TabsPageModule'
/*
}, {
path : 'event/:id',
loadChildren : './event/event.module#EventModule'
}, {
path : 'ngo/:id',
loadChildren : './ngo/ngo.module#NgoModule'
*/
}, {
path : 'volunteer/:id',
loadChildren : './volunteer/volunteer.module#VolunteerModule'
}];
@NgModule({
imports: [RouterModule.forRoot(routes, { enableTracing: true })],
exports: [RouterModule]
})
export class AppRoutingModule {}
const routes = [{
path : 'home',
loadChildren : './home/home.module#VolunteerHomePageModule'
}, {
path : 'event',
loadChildren : './event/event.module#VolunteerEventPageModule'
}, {
path : 'achievement',
loadChildren : './achievement/achievement.module#VolunteerAchievementPageModule'
}, {
path : '',
redirectTo : 'home'
}];
const routes = [{
path : 'home',
loadChildren : './home/home.module#NgoHomePageModule'
}, {
path : 'upcoming',
loadChildren : './upcoming /upcoming.module#NgoUpcomingPageModule'
}, {
path : 'past',
loadChildren : './past/past.module#NgoPastPageModule'
}, {
path : 'volunteer',
loadChildren : './volunteer/volunteer.module#NgoVolunteerPageModule'
}, {
path : '',
redirectTo : 'home'
}];
如上述代码所示,如果我注释掉3条路径中的任意2条,事件
,非政府组织
或志愿者
,则路由工作正常
但当我同时启用这两条路径中的任何一条时,我会得到以下错误:
Error: Cannot find 'NgoHomePageModule' in './home/home.module'
at checkNotEmpty (core.js:5007)
at core.js:4984
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388)
at Object.onInvoke (core.js:3820)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:387)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:138)
at zone.js:872
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:3811)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at checkNotEmpty (core.js:5007)
非政府组织或志愿者在每次爱奥尼亚服务中随机出现
在my模块中路由
const routes: Routes = [{
path : '',
loadChildren : './tabs/tabs.module#TabsPageModule'
/*
}, {
path : 'event/:id',
loadChildren : './event/event.module#EventModule'
}, {
path : 'ngo/:id',
loadChildren : './ngo/ngo.module#NgoModule'
*/
}, {
path : 'volunteer/:id',
loadChildren : './volunteer/volunteer.module#VolunteerModule'
}];
@NgModule({
imports: [RouterModule.forRoot(routes, { enableTracing: true })],
exports: [RouterModule]
})
export class AppRoutingModule {}
const routes = [{
path : 'home',
loadChildren : './home/home.module#VolunteerHomePageModule'
}, {
path : 'event',
loadChildren : './event/event.module#VolunteerEventPageModule'
}, {
path : 'achievement',
loadChildren : './achievement/achievement.module#VolunteerAchievementPageModule'
}, {
path : '',
redirectTo : 'home'
}];
const routes = [{
path : 'home',
loadChildren : './home/home.module#NgoHomePageModule'
}, {
path : 'upcoming',
loadChildren : './upcoming /upcoming.module#NgoUpcomingPageModule'
}, {
path : 'past',
loadChildren : './past/past.module#NgoPastPageModule'
}, {
path : 'volunteer',
loadChildren : './volunteer/volunteer.module#NgoVolunteerPageModule'
}, {
path : '',
redirectTo : 'home'
}];
在myNgoModule中路由
const routes: Routes = [{
path : '',
loadChildren : './tabs/tabs.module#TabsPageModule'
/*
}, {
path : 'event/:id',
loadChildren : './event/event.module#EventModule'
}, {
path : 'ngo/:id',
loadChildren : './ngo/ngo.module#NgoModule'
*/
}, {
path : 'volunteer/:id',
loadChildren : './volunteer/volunteer.module#VolunteerModule'
}];
@NgModule({
imports: [RouterModule.forRoot(routes, { enableTracing: true })],
exports: [RouterModule]
})
export class AppRoutingModule {}
const routes = [{
path : 'home',
loadChildren : './home/home.module#VolunteerHomePageModule'
}, {
path : 'event',
loadChildren : './event/event.module#VolunteerEventPageModule'
}, {
path : 'achievement',
loadChildren : './achievement/achievement.module#VolunteerAchievementPageModule'
}, {
path : '',
redirectTo : 'home'
}];
const routes = [{
path : 'home',
loadChildren : './home/home.module#NgoHomePageModule'
}, {
path : 'upcoming',
loadChildren : './upcoming /upcoming.module#NgoUpcomingPageModule'
}, {
path : 'past',
loadChildren : './past/past.module#NgoPastPageModule'
}, {
path : 'volunteer',
loadChildren : './volunteer/volunteer.module#NgoVolunteerPageModule'
}, {
path : '',
redirectTo : 'home'
}];
我的文件夹结构:
▾ ngo/
▸ home/
▸ past/
▸ upcoming/
▸ volunteer/
[ ]ngo.module.spec.ts
[ ]ngo.module.ts
▸ tabs/
▾ volunteer/
▸ achievement/
▸ event/
▸ home/
[ ]volunteer.module.spec.ts
[ ]volunteer.module.ts
[ ]app-routing.module.ts
更新1:
将回购协议上传至
我做错了什么?请帮忙。成功了,但解决方案令人难以置信
使用唯一名称重命名功能的子文件夹,如下所示:
▾ ngo/
▸ home/ --> nhome/
▸ past/ --> npast/
▸ upcoming/ --> nupcoming/
▸ volunteer/ --> nvolunteer/
[ ]ngo.module.spec.ts
[ ]ngo.module.ts
▸ tabs/
▾ volunteer/
▸ achievement/ --> vachievement/
▸ event/ --> vevent/
▸ home/ --> vhome/
[ ]volunteer.module.spec.ts
[ ]volunteer.module.ts
[ ]app-routing.module.ts
这一变化解决了这个问题。但是我不明白为什么!对此有何解释
将其推到面临相同的问题,但我只是停止了
爱奥尼亚服务
并重新执行了它。创建stackblitz,这将有助于确定问题。@SureshKumarAriya无法在stackblitz中工作(可能是因为我或我是新手),所以我将该报告上载到gitlab,并用链接更新了帖子。谢谢。我想我们刚刚发现了一只角虫。