为什么在使用延迟加载时未显示特定模块?

时间:2019-07-26 07:34:32

标签: angular typescript

当我使用负载儿童时,正常路线是 工作正常,但模块无法在角度7中工作。

这是用于运行Angular7的Linux。

home-page.routing.module.ts:

    import { NgModule } from '@angular/core';
    import { Routes, RouterModule } from '@angular/router';
    import { HomePageComponent } from './home-page.component';
    const routes: Routes = [{
    path: '',
     component: HomePageComponent,
    }];

    @NgModule({
      imports: [RouterModule.forChild(routes)],
      exports: [RouterModule],
    })
    export class HomePageRoutingModule { }

    export const routedComponents = [
      HomePageComponent,
    ];

    home-page.module.ts:
    import { NgModule } from '@angular/core';
    import { ChartsModule } from '../charts/charts.module';
    import { ThemeModule } from '../../@theme/theme.module';
    import { HomePageRoutingModule, routedComponents } from 
    './home-page-routing.module';
    import { NgxPaginationModule } from 'ngx-pagination';
    @NgModule({
    imports: [
      ThemeModule,
      ChartsModule,
      HomePageRoutingModule,
      NgxPaginationModule,
    ],
    declarations: [
      routedComponents,
    ],
    })
    export class HomePageModule { }

    app-routing.module.ts:
    import { RouterModule, Routes } from '@angular/router';
    import { NgModule } from '@angular/core';
    const routes: Routes = [{
    path: 'asset',
     loadChildren: './home-page/home-page.module#HomePageModule',
    }];

    @NgModule({
      imports: [RouterModule.forChild(routes)],
      exports: [RouterModule],
    })
    export class AppRoutingModule {
    }

“该组件无法正常工作。” 我在上面提到了我的代码。

0 个答案:

没有答案