大佬教程收集整理的这篇文章主要介绍了Angular 4延迟加载和路由不起作用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题是这个延迟加载模块内部有子组件的路由.但是在我的路由器配置上这条路线没有出现……所以当我打电话给懒人模块时,我的屏幕上没有显示任何内容.
这是我的路由器配置(主模块):
export const MODULE_ROUTES: Route[] =[ { path: '',redirectTo: 'dashboard',pathMatch: 'full' },{ path: 'dashboard',component: HomeComponent,canActivate: [AuthGuard] },{ path: 'calendar',loadChildren: 'app/dashboard/calendar/calendar-module.module#CalendarModuleModule',canActivate: [AuthGuard]},{ path: '**',component: NoPageFoundComponent,pathMatch: 'full' } ] . . . @NgModule({ imports: [ RouterModule.forChild(MODULE_ROUTES) . . .
在我的懒惰模块上:
export const MODULE_CALENDAR_ROUTES: Route[] = [ { path: 'calendar',component: CalendarComponent,canActivateChild: [AuthGuard,CalendarGuard],children: [ { path: '',component: MainCalendarComponent,CalendarGuard] },{ path: 'user',component: EditEventComponent,CalendarGuard] } ] } ] . . . @NgModule({ imports: [ SharedModule,. . . RouterModule.forChild(MODULE_CALENDAR_ROUTES)
如果我打印我的路由器配置,我的懒惰模块上的路由声明不显示:
Routes: [ { "path": "dashboard","canActivate": [ null ] },{ "path": "calendar","loadChildren": "app/dashboard/calendar/calendar-module.module#CalendarModuleModule",{ "path": "**","pathMatch": "full" },{ "path": "dashboard" } ]
你能帮助我吗?
以上是大佬教程为你收集整理的Angular 4延迟加载和路由不起作用全部内容,希望文章能够帮你解决Angular 4延迟加载和路由不起作用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。