简体   繁体   English

Angular 2错误错误:类型dataGrid是2个模块(相同模块)的声明的一部分:DataGridModule和DataGridModule

[英]Angular 2 error Error: Type dataGrid is part of the declarations of 2 modules(same module): DataGridModule and DataGridModule

I have many feature modules which imports DataGridModule. 我有许多导入DataGridModule的功能模块。 When I traverse such that when one feature module is loaded and navigate to another feature module, I get the below error, 遍历以使在加载一个功能模块并导航到另一个功能模块时,出现以下错误,

EXCEPTION: Uncaught (in promise): Error: Type dataGrid is part of the declarations of 2 modules: DataGridModule and DataGridModule! 例外:未捕获(承诺):错误:类型dataGrid是以下两个模块的声明的一部分:DataGridModule和DataGridModule! Please consider moving dataGrid to a higher module that imports DataGridModule and DataGridModule. 请考虑将dataGrid移至导入DataGridModule和DataGridModule的更高模块。 You can also create a new NgModule that exports and includes dataGrid then import that NgModule in DataGridModule and DataGridModule. 您还可以创建一个新的NgModule,该NgModule导出并包含dataGrid,然后在DataGridModule和DataGridModule中导入该NgModule。

DataGridModule: DataGridModule:

import {Compiler, Component,NgModule} from '@angular/core';
import { CommonModule }   from '@angular/common';
import {dataGrid} from './dataGrid';
import { DataTableModule,SharedModule,DataScrollerModule } from 'primeng/primeng';

@NgModule({
      imports: [DataTableModule,SharedModule,DataScrollerModule,CommonModule],
      declarations: [dataGrid],
      entryComponents: []  ,
      exports:[dataGrid]
    })

export class DataGridModule { }

Zone.Module.ts 区域模块

import {NgModule} from '@angular/core';
import {SharedFormModule} from '../../../../../../../UMSToolkit/UIToolkit/shared/shared-form.module';
import {DataGridModule} from '../../../../../../../UMSToolkit/UIToolkit/xdata/view/datagrid.module';
import {ZoneRoutingModule} from './Zone-routing.module';
import {RevertModule} from '../../shared/Revert.module'

@NgModule({
    imports:      [SharedFormModule,DataGridModule,ZoneRoutingModule,RevertModule],
    declarations: [],
    bootstrap:    [ ],
    entryComponents: [],
    providers: []
  })

  export class ZoneModule { }

BasicDataGrid module BasicDataGrid模块

import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {DataGridModule} from '../../../../../../../../UMSToolkit/UIToolkit/xdata/view/dataGrid.module';
import {BasicDataGridComponent} from './basic-datagrid.component';

@NgModule({
    imports: [DataGridModule,CommonModule],
    declarations: [BasicDataGridComponent]
})
export class BasicDataGridModule
{

}

It was the typo error with case. 这是大小写错误。 Notice that BasicGridComponent was have dataGrid.module with a capital G causing the issue. 请注意,BasicGridComponent的dataGrid.module带有大写的G,从而导致了问题。

Thanks, 谢谢,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 角度错误:“是2个模块的声明的一部分(相同)” - Angular Error: “is part of the declarations of 2 modules (same)” 错误:类型组件是 2 个模块声明的一部分 - Error: Type Component is part of the declarations of 2 modules 类型页面是 2 个模块错误声明的一部分 - Type page is part of the declarations of 2 modules error 类型 LeadPage(Module) 是 2 个模块声明的一部分 - Type LeadPage(Module) is part of the declarations of 2 modules 类型Y是2个模块的声明的一部分-Angular 2 - Type Y is part of the declarations of 2 modules - Angular 2 构建错误“类型...... 是 2 个模块声明的一部分:AppModule - Ionic - Build Error “Type …. is part of the declarations of 2 modules: AppModule - Ionic 错误:类型 LoginComponent 是 2 个模块声明的一部分:LoginModule 和 AppModule - Error: Type LoginComponent is part of the declarations of 2 modules: LoginModule and AppModule 类型“ LocationComponent”是2个模块的声明的一部分:角6? - Type “LocationComponent” is part of the declarations of 2 modules:Angular 6? angular7中的2个模块的声明错误 - declarations of 2 modules error in angular7 角2:类型ChildComponent是以下两个模块的声明的一部分:parent1Module和Parent2Module - Angular 2 : Type ChildComponent is a part of the declarations of 2 modules : parent1Module and Parent2Module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM