当使用Angular 9直接访问延迟加载的组件时,Webbrowser挂起
因此,我的app-routing.module.ts中包含以下内容:当使用Angular 9直接访问延迟加载的组件时,Webbrowser挂起,angular,angular-routing,angular9,ivy,angular-lazyloading,Angular,Angular Routing,Angular9,Ivy,Angular Lazyloading,因此,我的app-routing.module.ts中包含以下内容: export const appRoutes: Routes = [ // Front {path: '', component: FrontComponent}, {path: 'login', component: SigninComponent, data: {activeTab: SigninAction.Login}}, {path: 'register', component: SigninComponent,
export const appRoutes: Routes = [
// Front
{path: '', component: FrontComponent},
{path: 'login', component: SigninComponent, data: {activeTab: SigninAction.Login}},
{path: 'register', component: SigninComponent, data: {activeTab: SigninAction.Register}},
// Lazy loaded features
{path: 'user', canActivate: [LoginGuard], loadChildren: () => import('../user /user.module').then(m => m.UserModule)},
{path: 'announcement', loadChildren: () => import('../announcement/announcement.module').then(m => m.AnnouncementModule) },
];
@NgModule({
imports: [
CommonModule,
RouterModule.forRoot(appRoutes, {onSameUrlNavigation: 'reload'})
],
exports: [RouterModule],
})
export class AppRoutingModule { }
到用户的路由工作正常。但是对于公告路由,浏览器挂起并且无法恢复,因此我需要重新启动
公告功能中的路由模块如下所示
export const routes: Routes = [
//// applications
{path: 'apply', component: ApplyComponent},
//// invitations
{
path: 'find',
component: FindInvitationComponent,
canActivate: [ViewInvitationsGuard],
},
{path: '', component: DummyTestComponent}
];
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(routes)
],
declarations: [],
exports: [RouterModule]
})
导出类公告路由模块{
}
我将一个虚拟组件放入其中,以便它在开发中加载得更快
当不使用Ivy时,就像在我的产品构建中一样,同样的配置工作得非常完美,防护装置没有被触动,但现在,请求甚至不会首先触动防护装置。即使移除了防护装置,我也没有运气(注意,我直接访问路由,因此通过直接输入浏览器的url)
只是不知道为什么浏览器在没有任何控制台信息或网络请求的情况下进入某种循环
有什么想法吗?非常感谢 你能创建一个StackBlitz演示或类似的东西吗?