angular - 错误:BrowserModule 已加载。, 改为导入 CommonModule
问题描述
我已经使用 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 { }
解决方案
推荐阅读
- ios - 是否可以使用偏移/分页从 CoreStore 获取记录?
- javascript - $http 调用两次: OPTION 然后在 AngularJS 中 GET
- filter - Clojure:将过滤器与具有多个参数的函数一起使用
- android - IBM Watson Assistant:对话框在“试用”中工作,但不在 Android 应用程序中
- ms-access - “&”关键字对访问标题属性有什么作用?
- sql - 将 DATE 转换为 UTC 时间中的 DATE:sys_extract_utc 对于 sysdate 和 systimestamp 的行为不同
- c++ - 如何使用基类函数获取继承类的路径?
- android - 在 Xamarin Android 中查找模式 NavigationPage 的工具栏
- javascript - 如何从 prettier 中忽略 node_modules
- reactjs - 将翻译后的文本作为道具传递