我正在开发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会即时渲染,但会延迟渲染。有什么想法为什么会延迟渲染?
答案 0 :(得分:0)
在没有提供代码的情况下很难获得帮助,重要的内容没有包含在您的帖子中。但是,我要冒险...看来您要尝试做的是为功能加载屏幕,但操作不正确。
ngOnInit() {
this.router.events.subscribe(event => {
if (event instanceof RouteConfigLoadStart) {
// siteLoading(true);
} else if (event instanceof RouteConfigLoadEnd) {
// siteLoading(false);
}
});
}