Angular 仅在刷新后加载角度延迟模块
当我按下一个按钮时,这两个都在桌面上,但在移动设备上更多:Angular 仅在刷新后加载角度延迟模块,angular,angular9,Angular,Angular9,当我按下一个按钮时,这两个都在桌面上,但在移动设备上更多: 详细信息 路由已更改,但模块和组件未加载。 它仅在刷新后加载。 然而,在dekstop上,这种情况不会发生很多次 应用程序路由.module.ts 常数路由:路由=[ {路径:'',重定向到:“欢迎”,路径匹配:“完整”}, { 路径:“欢迎”, loadChildren:()=>import('./modules/welcome/welcome.module')。然后((m)=>m.WelcomeModule), }, { 路径:
详细信息
路由已更改,但模块和组件未加载。
它仅在刷新后加载。
然而,在dekstop上,这种情况不会发生很多次
应用程序路由.module.ts
常数路由:路由=[
{路径:'',重定向到:“欢迎”,路径匹配:“完整”},
{
路径:“欢迎”,
loadChildren:()=>import('./modules/welcome/welcome.module')。然后((m)=>m.WelcomeModule),
},
{
路径:“auth”,
loadChildren:()=>import('./modules/auth/auth.module')。然后((m)=>m.AuthModule),
},
{
路径:“应用程序”,
组件:MainLayoutComponent,
儿童:[
{路径:'',重定向到:'pages',路径匹配:'full'},
{
路径:“页面”,
loadChildren:()=>import('./modules/pages/pages.module')。然后((m)=>m.PagesModule),
canActivate:[AuthGuard],
},
{
路径:“配置文件”,
loadChildren:()=>import('./modules/profiles/profiles.module')。然后((m)=>m.ProfilesModule),
canActivate:[AuthGuard],
},
],
},
{
路径:'**',
组件:PageNotFoundComponent,
},
];
页面路由.module.ts
const routes:routes=[
{
路径:“”,
组件:PagesListComponent,
},
{
路径:“创建”,
组件:CreateUpdatePageComponent,
},
{
路径:':id',
组件:PageDetails组件,
},
{
路径:':id/update',
组件:CreateUpdatePageComponent,
},
];
@NGD模块({
导入:[RouterModule.forChild(路由)],
导出:[路由模块],
})
导出类PagesRoutingModule{}
请尝试以下操作:
<button mat-stroked-button [routerLink] = "['/app/pages/' + page.id]"> Details </ button>
详细信息
在基本路由模块中,您可以尝试激活调试:
RouterModule.forRoot(routes,{enableTracing:true}),我在角度区域外触发了这个警告:导航,你忘了调用“ngZone.run()”?什么时候?按一下按钮。启动时?单击按钮时