问题在路线更改Angular上显示加载程序

问题描述

在更改路线时,如果要花费一些时间,我希望出现装载机微调器。我尝试实施此操作,但没有显示微调框的运气。

这是我当前的实现: 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 (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...