错误:已加载BrowserModule。 ,改为导入CommonModule

时间:2020-07-23 06:39:28

标签: angular typescript

我已经使用IntegralUIModule实现TreeGrid,但是模块实现存在问题。由于CommonModule也存在于来自Node_Modules的IntegralUIModule中

ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.

我的自定义模块。ts:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
// import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { PanelsModule } from 'src/app/shared/panels/panels.module';
import { GLGDemoComponent } from './glg-demo1/glg-demo.component';
import { GLGDemo2Component } from './glg-demo2/glg-demo2.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { IntegralUIModule } from '../../../../node_modules/@lidorsystems/integralui-web/bin/integralui/integralui.module';

@NgModule({
  declarations: [GLGDemoComponent, GLGDemo2Component],
  providers: [],
  imports: [
    CommonModule,
    FormsModule,
    PanelsModule,
    ReactiveFormsModule,
    IntegralUIModule,
    RouterModule.forChild([
      { path: '', pathMatch: 'full', component: GLGDemoComponent, data: { breadcrumbs: ['GLG', 'Screen 1'] } },
      { path: 'screen1', component: GLGDemoComponent, data: { breadcrumbs: ['GLG', 'Screen 1'] } },
      { path: 'TreeGrid', component: GLGDemo2Component, data: { breadcrumbs: ['Tree Grid', 'Grid'] } },
     ])
  ]
})
export class GLGDemoModule { }

0 个答案:

没有答案