0

我正在关注有关延迟加载的文档,但在 Angular 10 项目中出现以下错误

ERROR in src/app/modules/app-routing.module.ts:21:52 - error TS2339: Property 'MergeModule' does not exist on type 'typeof import("C:/.../src/app/modules/merge/merge.module")'.

我的路线中有以下内容

{
  path: 'merge',
  loadChildren: () =>
    import('./merge/merge.module').then((m) => m.MergeModule)
}

其余的都很空

import { NgModule } from '@angular/core';
import CommonModule from '../shared.module';
import MergeRoutingModule from './merge-routing.module';
import MergeContainerComponent from './container.component';

@NgModule({
  declarations: [MergeContainerComponent],
  imports: [CommonModule, MergeRoutingModule]
})
export default class MergeModule {}

而特征路由模块是这样的

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';    
import MergeContainerComponent from './container.component';

const routes: Routes = [
  {
    path: '',
    component: MergeContainerComponent
  }
];

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

0 回答 0