首页 > 解决方案 > 重构不再可用的 Angular `LoadedRouterConfig` 导入

问题描述

我有一个 Angular 应用程序,我正在升级到版本 8,并且LoadedRouterConfig遇到了不再公开的问题。我找不到任何关于此的 Angular 文档,所以我不确定如何重新编写使用它的代码。似乎它正在动态创建动态路线?

  import {LoadedRouterConfig} from '@angular/router/src/config';
  .....

  item.path = path;
  item.children = [];
  if (route.children !== undefined && route.children.length > 0) {
    this.childrenProcess(route.children, path, item, context );
  } else if (route.loadChildren !== undefined) {
    const loadedRouterConfig: LoadedRouterConfig = (route as any)._loadedConfig;
    if (loadedRouterConfig !== undefined ) {
      this.childrenProcess(loadedRouterConfig.routes, path, item, context);
    }
  }

标签: javascriptangularangular-ui-router

解决方案


推荐阅读