I'm using multiple module with lazy loading concept but i'm getting given below error:
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.
app.module.ts
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app.routes';
import { CookieModule } from 'ngx-cookie';
/* Modules */
import { SharedModule } from 'shared/shared.module';
/* Components */
import { AppComponent } from './app.component';
/* Models */
import { User } from './shared/models/user';
// /* Services */
import { GlobalLoader } from './core/global-loader';
import { SecurityService } from './shared/services/security.service';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
declarations: [
AppComponent
],
entryComponents: [], // Needed to declare dynamic components
imports: [
BrowserModule,
AppRoutingModule,
CookieModule.forRoot(),
SharedModule,
],
exports: [
SharedModule
],
providers: [SecurityService,
GlobalLoader,
User],
bootstrap: [AppComponent]
})
export class AppModule { }
shared.module.ts
import { NgModule } from '@angular/core';
// import { FormsModule } from '@angular/forms';
// Small sample component used for dymanic tabs/accordion
/* Components */
import { SampleContent } from './components/sample-content';
import { AccordionCardComponent } from './components/accordion-card/accordion-card.component';
import { BannerComponent } from './components/banner/banner.component';
import { HeaderComponent } from './components/header/header.component';
import { SearchComponent } from './components/search/search.component';
import { TabCardComponent } from './components/tab-card/tab-card.component';
import { TableCardComponent } from './components/table-card/table-card.component';
import { Base64Pipe } from './pipes/base64.pipe';
import { FlexLayoutModule } from '@angular/flex-layout';
import { UXStyleguideModule } from 'ux-angular-styleguide';
import { CommonModule } from '@angular/common';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
// import { RouterModule } from '@angular/router';
/* Shared */
@NgModule({
declarations: [
Base64Pipe,
SampleContent,
AccordionCardComponent,
BannerComponent,
HeaderComponent,
SearchComponent,
TabCardComponent,
TableCardComponent
],
entryComponents: [], // Needed to declare dynamic components
imports: [
HttpClientModule,
FormsModule,
CommonModule,
NgxDatatableModule,
FlexLayoutModule,
UXStyleguideModule],
providers: [],
exports: [
HttpClientModule,
FlexLayoutModule,
NgxDatatableModule,
FormsModule,
CommonModule,
UXStyleguideModule,
Base64Pipe,
SampleContent,
AccordionCardComponent,
BannerComponent,
HeaderComponent,
SearchComponent,
TabCardComponent,
TableCardComponent
]
})
export class SharedModule { }
and i have nowhere imported that browserModule but still getting error.
thanks in adavance.