我正在开发一个Angular 6应用程序,我的应用程序通常显示路由连接的组件。但是当页面加载时(重新加载Ctrl+R/F5时),延迟加载组件;
<div [loading]="loading">
<app-header></app-header>
<div id="pageContentWrapper">
<router-outlet (activate)="onActivate($event)"></router-outlet>
</div>
<app-footer></app-footer>
</div>这是我的代码;app-header和app-footer是即时呈现的,但会延迟呈现。你知道为什么渲染会延迟吗?
发布于 2019-04-01 02:49:59
没有提供代码的情况下很难获得帮助,重要的部分没有包含在你的帖子中。然而,我要冒个险……看起来你想要做的是为一个功能创建一个加载屏幕,但是没有正确地执行它。
ngOnInit() {
this.router.events.subscribe(event => {
if (event instanceof RouteConfigLoadStart) {
// siteLoading(true);
} else if (event instanceof RouteConfigLoadEnd) {
// siteLoading(false);
}
});
}https://stackoverflow.com/questions/55443484
复制相似问题