admin管理员组文章数量:1291797
I'm having a problem in my hybrid angular application, when starting the application on an angular 2+ page, the angular js pages don't load, it only works if I refresh within an angular js page, then it loads normally, if I navigate to angular 2+ pages and return to the angular js pages they work correctly.
Versions used: angular v18, angularjs
@Component({
selector: 'app-angular-js',
template: ''
})
export class AngularJSComponent implements OnInit, OnDestroy {
constructor(
private lazyLoader: LazyLoaderService,
private elRef: ElementRef
) {}
ngOnInit() {
this.lazyLoader.load(this.elRef.nativeElement);
}
ngOnDestroy() {
this.lazyLoader.destroy();
}
}
Route
{
matcher: isAngularJSUrl,
component: AngularJSComponent,
canActivate: [OperationKeyGuard]
}
AppModule
@NgModule({
declarations: [AppComponent],
imports: [...IMPORTS],
providers: [...PROVIDERS],
bootstrap: [AppComponent]
})
export class AppModule implements DoBootstrap {
constructor(private readonly upgrade: UpgradeModule) {}
ngDoBootstrap() {
this.upgrade.bootstrap(document.body, [MyAppJs], { strictDi: true });
}
}
If anyone has been through this and can help me, I would be grateful in advance.
本文标签:
版权声明:本文标题:javascript - hybrid angular app (angular 18 with angular JS), lazy loading module not working when page is refreshed - Stack Ove 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741540662a2384301.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论