问题描述
在更改路线时,如果要花费一些时间,我希望出现装载机微调器。我尝试实施此操作,但没有显示微调框的运气。
这是我当前的实现: app.component:
constructor(
private oauthService: OAuthService,private userService: UserService,private userSessionService: UserSessionService,private sessionDataStore: SessionDataStoreService,private permissionService: PermissionService,private router: Router,private httpCancelService: HttpCancelService) {
this.router.events.subscribe((event: RouterEvent) => {
switch (true) {
case event instanceof NavigationStart: {
this.loading = true;
break;
}
case event instanceof NavigationEnd:
case event instanceof NavigationCancel:
case event instanceof NavigationError: {
this.loading = false;
break;
}
default: {
break;
}
}
});
}
app.component.html:
<app-api-error></app-api-error>
<app-bar-horizontal *ngIf='loadSuccessful'></app-bar-horizontal>
<router-outlet></router-outlet>
<div *ngIf="loading" _ngcontent-c4="" class="loader-placeholder">
<div _ngcontent-c4="" class="loader loader-lg" role="status">
<div _ngcontent-c4="" class="loader-ring" id="loader3">
</div>
<label _ngcontent-c4="" for="loader3">Loading data</label>
</div>
</div>
<app-loader *ngIf="!loading"></app-loader>
<app-loader>
适用于我的http请求,并且该加载程序工作得很好。但是不会在加载程序的路由之间切换。
我该如何解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)