Lazy Loading BrowserModule has already been loaded












7















I am trying to implement lazy loading but getting error as following
**




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.




**



Need Help on this.
Here are my Modules




  1. Shared MOdule



@NgModule({

declarations: [TimePipe],
providers: [
EmsEmployeeService,
EmsDesignationService,
EmsOrganizationService,
EmsAuthService,
AmsEmployeeService,
AmsShiftService,
ValidatorService,
AmsLeaveService,
AmsAttendanceService,
AmsDeviceService,
AmsOrganizationService,
AmsAlertService,
AmsHolidayService,
AutoCompleteService,
AmsTimelogsService,
LocalStorageService
],
imports: [
HttpModule,
ToastyModule.forRoot(),
AgmCoreModule.forRoot({
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
}),
],
exports: [
FormsModule,
HttpModule,
BrowserAnimationsModule,
RouterModule,
MaterialModule,
MdDatepickerModule,
MdNativeDateModule,
ToastyModule,
FileUploadModule,
NgxPaginationModule,
NguiAutoCompleteModule,
AgmCoreModule,
TimePipe
]
})
export class SharedModule { }



2.SettingModule




 @NgModule({
imports: [
CommonModule,
SharedModule,
SettingsRoutingModule
],
declarations: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent
], exports: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent,
]
})
export class SettingsModule { }



3.SettingRoutingModule



const settings_routes: Routes = [
{ path: '', redirectTo: 'shifts', pathMatch: 'full' },
{ path: 'shifts', component: ShiftsComponent },
{ path: 'shifts/new', component: ShiftTypeNewComponent },
{ path: 'shifts/edit/:id', component: ShiftTypeNewComponent },
{ path: 'devices', component: DevicesComponent },
{ path: 'deviceLogs', component: DeviceLogsComponent },
{ path: 'holidays', component: HolidaysComponent },
{ path: 'alerts', component: AlertsComponent },
{ path: 'alerts/types', component: AlterTypesComponent },
{ path: 'alerts/:id', component: AlterEditComponent },
{ path: 'channelTypes', component: ChannelTypesComponent },
{ path: 'channelTypes/:id', component: ChannelTypeEditComponent }
];


const routes: Routes = [
{ path: '', component: SettingsComponent, children: settings_routes }
];



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




  1. App-routing-module



const attdendance_routes: Routes = [
{ path: '', redirectTo: 'daily', pathMatch: 'full' },
{ path: 'monthly', component: MonthlyComponent },
{ path: 'daily', component: DailyComponent },

{ path: 'daily/:empId', component: AttendanceDetailsComponent },
{ path: 'details/:empId', component: AttendanceDetailsComponent },
{ path: 'monthly/:empId', component: AttendanceDetailsComponent },
{ path: 'leaves/:empId', component: AttendanceDetailsComponent },

{ path: 'details/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/attendance-logs/:ofDate', component: AttendanceLogsComponent },
{ path: 'monthly/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/new/apply', component: ApplyLeaveComponent },

{ path: 'leaves', component: LeavesComponent },
{ path: 'leave-balances', component: LeaveBalancesComponent },
{ path: 'leave-balances/:empId', component: AttendanceDetailsComponent },
{ path: 'manage-leaves', component: ManageLeavesComponent },

];



const emp_routes: Routes = [
{ path: '', redirectTo: 'list', pathMatch: 'full' },
{ path: 'list', component: EmployeeListComponent },
{ path: 'list/:id', component: EmpEditComponent },
{ path: 'designations', component: DesignationsComponent }
];



const page_routes: Routes = [
{ path: '', redirectTo: 'attendances', pathMatch: 'full' },
{ path: 'employees', component: EmployeesComponent, children: emp_routes },
{ path: 'attendances', component: AttendancesComponent, children: attdendance_routes },

{ path: 'settings', loadChildren: './pages/settings/settings.module#SettingsModule' },
];

// main routes
const routes: Routes = [
{ path: '', redirectTo: 'pages', pathMatch: 'full' },
{ path: 'login', component: LoginComponent, canActivate: [LoginGuard] },
{ path: 'pages', component: PagesComponent, canActivate: [UserGuard], children: page_routes },
{ path: 'loginViaOrg', component: OrgLoginComponent },
{ path: 'download', component: AppDownloadComponent },
{ path: '**', redirectTo: 'pages' },
];

@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }



5.AppModule




@NgModule({

declarations: [
AppComponent,
PagesComponent,
LoginComponent,
EmployeesComponent,
OrgLoginComponent,
EmployeeListComponent,
EmpEditComponent,
DayEventDialogComponent,
AttendancesComponent,
MonthlyComponent,
AttendanceDetailsComponent,
DailyComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
LeavesComponent,
LeaveBalancesComponent,
ManageLeavesComponent,
ApplyLeaveComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent,
AppDownloadComponent,
DesignationsComponent,
AttendanceLogsComponent,
],

entryComponents: [
DayEventDialogComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent
],

imports: [
BrowserModule,
// CommonModule,
SharedModule,
AppRoutingModule,
// feature modules
// SettingsModule
],

providers: [
LoginGuard, UserGuard,
],

bootstrap: [AppComponent]
})
export class AppModule { }










share|improve this question

























  • Do you get this error on initial load of index.html or when you navigate to /settings ?

    – Günter Zöchbauer
    Aug 31 '17 at 7:46











  • @GünterZöchbauer while navigating to " /settings"

    – Er Sushil
    Aug 31 '17 at 7:47











  • Are you sure none of all the involved modules (except AppModule) imports BrowserModule?

    – Günter Zöchbauer
    Aug 31 '17 at 7:51











  • @GünterZöchbauer I Have imported CommonModule in all modules (except AppModule)

    – Er Sushil
    Aug 31 '17 at 7:54








  • 1





    @GünterZöchbauer I found Solution, I was importing BrowerAnimationModule in child.modules

    – Er Sushil
    Aug 31 '17 at 9:59
















7















I am trying to implement lazy loading but getting error as following
**




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.




**



Need Help on this.
Here are my Modules




  1. Shared MOdule



@NgModule({

declarations: [TimePipe],
providers: [
EmsEmployeeService,
EmsDesignationService,
EmsOrganizationService,
EmsAuthService,
AmsEmployeeService,
AmsShiftService,
ValidatorService,
AmsLeaveService,
AmsAttendanceService,
AmsDeviceService,
AmsOrganizationService,
AmsAlertService,
AmsHolidayService,
AutoCompleteService,
AmsTimelogsService,
LocalStorageService
],
imports: [
HttpModule,
ToastyModule.forRoot(),
AgmCoreModule.forRoot({
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
}),
],
exports: [
FormsModule,
HttpModule,
BrowserAnimationsModule,
RouterModule,
MaterialModule,
MdDatepickerModule,
MdNativeDateModule,
ToastyModule,
FileUploadModule,
NgxPaginationModule,
NguiAutoCompleteModule,
AgmCoreModule,
TimePipe
]
})
export class SharedModule { }



2.SettingModule




 @NgModule({
imports: [
CommonModule,
SharedModule,
SettingsRoutingModule
],
declarations: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent
], exports: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent,
]
})
export class SettingsModule { }



3.SettingRoutingModule



const settings_routes: Routes = [
{ path: '', redirectTo: 'shifts', pathMatch: 'full' },
{ path: 'shifts', component: ShiftsComponent },
{ path: 'shifts/new', component: ShiftTypeNewComponent },
{ path: 'shifts/edit/:id', component: ShiftTypeNewComponent },
{ path: 'devices', component: DevicesComponent },
{ path: 'deviceLogs', component: DeviceLogsComponent },
{ path: 'holidays', component: HolidaysComponent },
{ path: 'alerts', component: AlertsComponent },
{ path: 'alerts/types', component: AlterTypesComponent },
{ path: 'alerts/:id', component: AlterEditComponent },
{ path: 'channelTypes', component: ChannelTypesComponent },
{ path: 'channelTypes/:id', component: ChannelTypeEditComponent }
];


const routes: Routes = [
{ path: '', component: SettingsComponent, children: settings_routes }
];



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




  1. App-routing-module



const attdendance_routes: Routes = [
{ path: '', redirectTo: 'daily', pathMatch: 'full' },
{ path: 'monthly', component: MonthlyComponent },
{ path: 'daily', component: DailyComponent },

{ path: 'daily/:empId', component: AttendanceDetailsComponent },
{ path: 'details/:empId', component: AttendanceDetailsComponent },
{ path: 'monthly/:empId', component: AttendanceDetailsComponent },
{ path: 'leaves/:empId', component: AttendanceDetailsComponent },

{ path: 'details/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/attendance-logs/:ofDate', component: AttendanceLogsComponent },
{ path: 'monthly/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/new/apply', component: ApplyLeaveComponent },

{ path: 'leaves', component: LeavesComponent },
{ path: 'leave-balances', component: LeaveBalancesComponent },
{ path: 'leave-balances/:empId', component: AttendanceDetailsComponent },
{ path: 'manage-leaves', component: ManageLeavesComponent },

];



const emp_routes: Routes = [
{ path: '', redirectTo: 'list', pathMatch: 'full' },
{ path: 'list', component: EmployeeListComponent },
{ path: 'list/:id', component: EmpEditComponent },
{ path: 'designations', component: DesignationsComponent }
];



const page_routes: Routes = [
{ path: '', redirectTo: 'attendances', pathMatch: 'full' },
{ path: 'employees', component: EmployeesComponent, children: emp_routes },
{ path: 'attendances', component: AttendancesComponent, children: attdendance_routes },

{ path: 'settings', loadChildren: './pages/settings/settings.module#SettingsModule' },
];

// main routes
const routes: Routes = [
{ path: '', redirectTo: 'pages', pathMatch: 'full' },
{ path: 'login', component: LoginComponent, canActivate: [LoginGuard] },
{ path: 'pages', component: PagesComponent, canActivate: [UserGuard], children: page_routes },
{ path: 'loginViaOrg', component: OrgLoginComponent },
{ path: 'download', component: AppDownloadComponent },
{ path: '**', redirectTo: 'pages' },
];

@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }



5.AppModule




@NgModule({

declarations: [
AppComponent,
PagesComponent,
LoginComponent,
EmployeesComponent,
OrgLoginComponent,
EmployeeListComponent,
EmpEditComponent,
DayEventDialogComponent,
AttendancesComponent,
MonthlyComponent,
AttendanceDetailsComponent,
DailyComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
LeavesComponent,
LeaveBalancesComponent,
ManageLeavesComponent,
ApplyLeaveComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent,
AppDownloadComponent,
DesignationsComponent,
AttendanceLogsComponent,
],

entryComponents: [
DayEventDialogComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent
],

imports: [
BrowserModule,
// CommonModule,
SharedModule,
AppRoutingModule,
// feature modules
// SettingsModule
],

providers: [
LoginGuard, UserGuard,
],

bootstrap: [AppComponent]
})
export class AppModule { }










share|improve this question

























  • Do you get this error on initial load of index.html or when you navigate to /settings ?

    – Günter Zöchbauer
    Aug 31 '17 at 7:46











  • @GünterZöchbauer while navigating to " /settings"

    – Er Sushil
    Aug 31 '17 at 7:47











  • Are you sure none of all the involved modules (except AppModule) imports BrowserModule?

    – Günter Zöchbauer
    Aug 31 '17 at 7:51











  • @GünterZöchbauer I Have imported CommonModule in all modules (except AppModule)

    – Er Sushil
    Aug 31 '17 at 7:54








  • 1





    @GünterZöchbauer I found Solution, I was importing BrowerAnimationModule in child.modules

    – Er Sushil
    Aug 31 '17 at 9:59














7












7








7


2






I am trying to implement lazy loading but getting error as following
**




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.




**



Need Help on this.
Here are my Modules




  1. Shared MOdule



@NgModule({

declarations: [TimePipe],
providers: [
EmsEmployeeService,
EmsDesignationService,
EmsOrganizationService,
EmsAuthService,
AmsEmployeeService,
AmsShiftService,
ValidatorService,
AmsLeaveService,
AmsAttendanceService,
AmsDeviceService,
AmsOrganizationService,
AmsAlertService,
AmsHolidayService,
AutoCompleteService,
AmsTimelogsService,
LocalStorageService
],
imports: [
HttpModule,
ToastyModule.forRoot(),
AgmCoreModule.forRoot({
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
}),
],
exports: [
FormsModule,
HttpModule,
BrowserAnimationsModule,
RouterModule,
MaterialModule,
MdDatepickerModule,
MdNativeDateModule,
ToastyModule,
FileUploadModule,
NgxPaginationModule,
NguiAutoCompleteModule,
AgmCoreModule,
TimePipe
]
})
export class SharedModule { }



2.SettingModule




 @NgModule({
imports: [
CommonModule,
SharedModule,
SettingsRoutingModule
],
declarations: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent
], exports: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent,
]
})
export class SettingsModule { }



3.SettingRoutingModule



const settings_routes: Routes = [
{ path: '', redirectTo: 'shifts', pathMatch: 'full' },
{ path: 'shifts', component: ShiftsComponent },
{ path: 'shifts/new', component: ShiftTypeNewComponent },
{ path: 'shifts/edit/:id', component: ShiftTypeNewComponent },
{ path: 'devices', component: DevicesComponent },
{ path: 'deviceLogs', component: DeviceLogsComponent },
{ path: 'holidays', component: HolidaysComponent },
{ path: 'alerts', component: AlertsComponent },
{ path: 'alerts/types', component: AlterTypesComponent },
{ path: 'alerts/:id', component: AlterEditComponent },
{ path: 'channelTypes', component: ChannelTypesComponent },
{ path: 'channelTypes/:id', component: ChannelTypeEditComponent }
];


const routes: Routes = [
{ path: '', component: SettingsComponent, children: settings_routes }
];



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




  1. App-routing-module



const attdendance_routes: Routes = [
{ path: '', redirectTo: 'daily', pathMatch: 'full' },
{ path: 'monthly', component: MonthlyComponent },
{ path: 'daily', component: DailyComponent },

{ path: 'daily/:empId', component: AttendanceDetailsComponent },
{ path: 'details/:empId', component: AttendanceDetailsComponent },
{ path: 'monthly/:empId', component: AttendanceDetailsComponent },
{ path: 'leaves/:empId', component: AttendanceDetailsComponent },

{ path: 'details/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/attendance-logs/:ofDate', component: AttendanceLogsComponent },
{ path: 'monthly/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/new/apply', component: ApplyLeaveComponent },

{ path: 'leaves', component: LeavesComponent },
{ path: 'leave-balances', component: LeaveBalancesComponent },
{ path: 'leave-balances/:empId', component: AttendanceDetailsComponent },
{ path: 'manage-leaves', component: ManageLeavesComponent },

];



const emp_routes: Routes = [
{ path: '', redirectTo: 'list', pathMatch: 'full' },
{ path: 'list', component: EmployeeListComponent },
{ path: 'list/:id', component: EmpEditComponent },
{ path: 'designations', component: DesignationsComponent }
];



const page_routes: Routes = [
{ path: '', redirectTo: 'attendances', pathMatch: 'full' },
{ path: 'employees', component: EmployeesComponent, children: emp_routes },
{ path: 'attendances', component: AttendancesComponent, children: attdendance_routes },

{ path: 'settings', loadChildren: './pages/settings/settings.module#SettingsModule' },
];

// main routes
const routes: Routes = [
{ path: '', redirectTo: 'pages', pathMatch: 'full' },
{ path: 'login', component: LoginComponent, canActivate: [LoginGuard] },
{ path: 'pages', component: PagesComponent, canActivate: [UserGuard], children: page_routes },
{ path: 'loginViaOrg', component: OrgLoginComponent },
{ path: 'download', component: AppDownloadComponent },
{ path: '**', redirectTo: 'pages' },
];

@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }



5.AppModule




@NgModule({

declarations: [
AppComponent,
PagesComponent,
LoginComponent,
EmployeesComponent,
OrgLoginComponent,
EmployeeListComponent,
EmpEditComponent,
DayEventDialogComponent,
AttendancesComponent,
MonthlyComponent,
AttendanceDetailsComponent,
DailyComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
LeavesComponent,
LeaveBalancesComponent,
ManageLeavesComponent,
ApplyLeaveComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent,
AppDownloadComponent,
DesignationsComponent,
AttendanceLogsComponent,
],

entryComponents: [
DayEventDialogComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent
],

imports: [
BrowserModule,
// CommonModule,
SharedModule,
AppRoutingModule,
// feature modules
// SettingsModule
],

providers: [
LoginGuard, UserGuard,
],

bootstrap: [AppComponent]
})
export class AppModule { }










share|improve this question
















I am trying to implement lazy loading but getting error as following
**




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.




**



Need Help on this.
Here are my Modules




  1. Shared MOdule



@NgModule({

declarations: [TimePipe],
providers: [
EmsEmployeeService,
EmsDesignationService,
EmsOrganizationService,
EmsAuthService,
AmsEmployeeService,
AmsShiftService,
ValidatorService,
AmsLeaveService,
AmsAttendanceService,
AmsDeviceService,
AmsOrganizationService,
AmsAlertService,
AmsHolidayService,
AutoCompleteService,
AmsTimelogsService,
LocalStorageService
],
imports: [
HttpModule,
ToastyModule.forRoot(),
AgmCoreModule.forRoot({
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
}),
],
exports: [
FormsModule,
HttpModule,
BrowserAnimationsModule,
RouterModule,
MaterialModule,
MdDatepickerModule,
MdNativeDateModule,
ToastyModule,
FileUploadModule,
NgxPaginationModule,
NguiAutoCompleteModule,
AgmCoreModule,
TimePipe
]
})
export class SharedModule { }



2.SettingModule




 @NgModule({
imports: [
CommonModule,
SharedModule,
SettingsRoutingModule
],
declarations: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent
], exports: [
SettingsComponent,
ShiftsComponent,
DevicesComponent,
AlertsComponent,
HolidaysComponent,
AlterTypesComponent,
AlterEditComponent,
ShiftTypeNewComponent,
DeviceLogsComponent,
ChannelTypesComponent,
ChannelTypeEditComponent,
]
})
export class SettingsModule { }



3.SettingRoutingModule



const settings_routes: Routes = [
{ path: '', redirectTo: 'shifts', pathMatch: 'full' },
{ path: 'shifts', component: ShiftsComponent },
{ path: 'shifts/new', component: ShiftTypeNewComponent },
{ path: 'shifts/edit/:id', component: ShiftTypeNewComponent },
{ path: 'devices', component: DevicesComponent },
{ path: 'deviceLogs', component: DeviceLogsComponent },
{ path: 'holidays', component: HolidaysComponent },
{ path: 'alerts', component: AlertsComponent },
{ path: 'alerts/types', component: AlterTypesComponent },
{ path: 'alerts/:id', component: AlterEditComponent },
{ path: 'channelTypes', component: ChannelTypesComponent },
{ path: 'channelTypes/:id', component: ChannelTypeEditComponent }
];


const routes: Routes = [
{ path: '', component: SettingsComponent, children: settings_routes }
];



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




  1. App-routing-module



const attdendance_routes: Routes = [
{ path: '', redirectTo: 'daily', pathMatch: 'full' },
{ path: 'monthly', component: MonthlyComponent },
{ path: 'daily', component: DailyComponent },

{ path: 'daily/:empId', component: AttendanceDetailsComponent },
{ path: 'details/:empId', component: AttendanceDetailsComponent },
{ path: 'monthly/:empId', component: AttendanceDetailsComponent },
{ path: 'leaves/:empId', component: AttendanceDetailsComponent },

{ path: 'details/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'daily/:empId/attendance-logs/:ofDate', component: AttendanceLogsComponent },
{ path: 'monthly/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/:empId/apply-leave', component: ApplyLeaveComponent },
{ path: 'leaves/new/apply', component: ApplyLeaveComponent },

{ path: 'leaves', component: LeavesComponent },
{ path: 'leave-balances', component: LeaveBalancesComponent },
{ path: 'leave-balances/:empId', component: AttendanceDetailsComponent },
{ path: 'manage-leaves', component: ManageLeavesComponent },

];



const emp_routes: Routes = [
{ path: '', redirectTo: 'list', pathMatch: 'full' },
{ path: 'list', component: EmployeeListComponent },
{ path: 'list/:id', component: EmpEditComponent },
{ path: 'designations', component: DesignationsComponent }
];



const page_routes: Routes = [
{ path: '', redirectTo: 'attendances', pathMatch: 'full' },
{ path: 'employees', component: EmployeesComponent, children: emp_routes },
{ path: 'attendances', component: AttendancesComponent, children: attdendance_routes },

{ path: 'settings', loadChildren: './pages/settings/settings.module#SettingsModule' },
];

// main routes
const routes: Routes = [
{ path: '', redirectTo: 'pages', pathMatch: 'full' },
{ path: 'login', component: LoginComponent, canActivate: [LoginGuard] },
{ path: 'pages', component: PagesComponent, canActivate: [UserGuard], children: page_routes },
{ path: 'loginViaOrg', component: OrgLoginComponent },
{ path: 'download', component: AppDownloadComponent },
{ path: '**', redirectTo: 'pages' },
];

@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }



5.AppModule




@NgModule({

declarations: [
AppComponent,
PagesComponent,
LoginComponent,
EmployeesComponent,
OrgLoginComponent,
EmployeeListComponent,
EmpEditComponent,
DayEventDialogComponent,
AttendancesComponent,
MonthlyComponent,
AttendanceDetailsComponent,
DailyComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
LeavesComponent,
LeaveBalancesComponent,
ManageLeavesComponent,
ApplyLeaveComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent,
AppDownloadComponent,
DesignationsComponent,
AttendanceLogsComponent,
],

entryComponents: [
DayEventDialogComponent,
DeviceDialogComponent,
LeaveActionDialogComponent,
ConfirmDialogComponent,
ResetPasswordDialogComponent
],

imports: [
BrowserModule,
// CommonModule,
SharedModule,
AppRoutingModule,
// feature modules
// SettingsModule
],

providers: [
LoginGuard, UserGuard,
],

bootstrap: [AppComponent]
})
export class AppModule { }







angular typescript angular2-routing lazy-loading angular2-modules






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 31 '17 at 10:48







Er Sushil

















asked Aug 31 '17 at 7:27









Er SushilEr Sushil

116112




116112













  • Do you get this error on initial load of index.html or when you navigate to /settings ?

    – Günter Zöchbauer
    Aug 31 '17 at 7:46











  • @GünterZöchbauer while navigating to " /settings"

    – Er Sushil
    Aug 31 '17 at 7:47











  • Are you sure none of all the involved modules (except AppModule) imports BrowserModule?

    – Günter Zöchbauer
    Aug 31 '17 at 7:51











  • @GünterZöchbauer I Have imported CommonModule in all modules (except AppModule)

    – Er Sushil
    Aug 31 '17 at 7:54








  • 1





    @GünterZöchbauer I found Solution, I was importing BrowerAnimationModule in child.modules

    – Er Sushil
    Aug 31 '17 at 9:59



















  • Do you get this error on initial load of index.html or when you navigate to /settings ?

    – Günter Zöchbauer
    Aug 31 '17 at 7:46











  • @GünterZöchbauer while navigating to " /settings"

    – Er Sushil
    Aug 31 '17 at 7:47











  • Are you sure none of all the involved modules (except AppModule) imports BrowserModule?

    – Günter Zöchbauer
    Aug 31 '17 at 7:51











  • @GünterZöchbauer I Have imported CommonModule in all modules (except AppModule)

    – Er Sushil
    Aug 31 '17 at 7:54








  • 1





    @GünterZöchbauer I found Solution, I was importing BrowerAnimationModule in child.modules

    – Er Sushil
    Aug 31 '17 at 9:59

















Do you get this error on initial load of index.html or when you navigate to /settings ?

– Günter Zöchbauer
Aug 31 '17 at 7:46





Do you get this error on initial load of index.html or when you navigate to /settings ?

– Günter Zöchbauer
Aug 31 '17 at 7:46













@GünterZöchbauer while navigating to " /settings"

– Er Sushil
Aug 31 '17 at 7:47





@GünterZöchbauer while navigating to " /settings"

– Er Sushil
Aug 31 '17 at 7:47













Are you sure none of all the involved modules (except AppModule) imports BrowserModule?

– Günter Zöchbauer
Aug 31 '17 at 7:51





Are you sure none of all the involved modules (except AppModule) imports BrowserModule?

– Günter Zöchbauer
Aug 31 '17 at 7:51













@GünterZöchbauer I Have imported CommonModule in all modules (except AppModule)

– Er Sushil
Aug 31 '17 at 7:54







@GünterZöchbauer I Have imported CommonModule in all modules (except AppModule)

– Er Sushil
Aug 31 '17 at 7:54






1




1





@GünterZöchbauer I found Solution, I was importing BrowerAnimationModule in child.modules

– Er Sushil
Aug 31 '17 at 9:59





@GünterZöchbauer I found Solution, I was importing BrowerAnimationModule in child.modules

– Er Sushil
Aug 31 '17 at 9:59












7 Answers
7






active

oldest

votes


















18














Import BrowserAnimationsModule and HttpModule only once (either in your root module or a core module).






share|improve this answer

































    3














    I also got the same error and finally, after little bit struggle, I was able to fix it.



    Import these mentioned modules only once(in app-module only):



    BrowserModule,
    BrowserAnimationsModule,
    LazyLoadImageModule (if using it),
    CarouselModule (if using it),
    InfiniteScrollModule (if using it),
    HttpModule ( if using it)






    share|improve this answer































      2














      This error can occur if you have imported BrowseModule in some child.app module.ts also. Please make sure you import CommonModule in all modules other than app.module as it has browser modules.






      share|improve this answer
























      • you can import CommonModule from '@angular/common'

        – Fatema Saifee
        Aug 31 '17 at 7:55











      • Still getting the same error. And you can check only in AppModule I have imported BrowseModule

        – Er Sushil
        Aug 31 '17 at 8:01











      • yeah me too, only imported in app module

        – fdsfdsfdsfds
        Apr 26 '18 at 12:57



















      1














      I had the same problem and Jota.Toledo gave the correct answer and I want only extend that: please check in shared module imports any modules that related with




      @angular/platform-browser/animations




      and move those modules into app.module.ts






      share|improve this answer































        0














        @First Import BrowerModule and in imports also first include BrowserModule import:[BrowerModule ] 

        import { BrowserModule } from '@angular/platform-browser';
        import { NgModule } from '@angular/core';

        import { AppRoutingModule } from './app-routing.module';
        import { AppComponent } from './app.component';

        @NgModule({
        declarations: [
        AppComponent
        ],
        imports: [
        BrowserModule,
        AppRoutingModule
        ],
        providers: ,
        bootstrap: [AppComponent]
        })
        export class AppModule { }


        If we declare BrowserModule in any module other than app module(Duplicate) this error will come. the In app module if we import 10 modules or plugins, first we have to import BrowserModule at the top and declare in decorates (import:[BrowserModule ]) at the top






        share|improve this answer





















        • 1





          Could you add some explanation to the code?

          – Federico Grandi
          Nov 22 '18 at 18:07











        • 1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

          – Brahmmeswara Rao Palepu
          Nov 23 '18 at 10:58











        • I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

          – Federico Grandi
          Nov 23 '18 at 15:48



















        0














        Include all the common modules in parent component only(or appModule only). In child module, include only Child specific modules.



        Also, you might need to add
        schemas: [NO_ERRORS_SCHEMA], in your child modules and parent modules






        share|improve this answer































          0














          If you are using multiple modules, use Browser module only once in your app module or some custom module and use CommonModule from @angular/common in custom modules.



          I was getting the same error , I was trying to reuse components, directives, pipes in multiple components/modules. Instead I imported all reusable components in a core module and imported the core module in multiple components/modules.






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45975675%2flazy-loading-browsermodule-has-already-been-loaded%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            7 Answers
            7






            active

            oldest

            votes








            7 Answers
            7






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            18














            Import BrowserAnimationsModule and HttpModule only once (either in your root module or a core module).






            share|improve this answer






























              18














              Import BrowserAnimationsModule and HttpModule only once (either in your root module or a core module).






              share|improve this answer




























                18












                18








                18







                Import BrowserAnimationsModule and HttpModule only once (either in your root module or a core module).






                share|improve this answer















                Import BrowserAnimationsModule and HttpModule only once (either in your root module or a core module).







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Oct 8 '17 at 8:58

























                answered Aug 31 '17 at 10:29









                Jota.ToledoJota.Toledo

                9,83462248




                9,83462248

























                    3














                    I also got the same error and finally, after little bit struggle, I was able to fix it.



                    Import these mentioned modules only once(in app-module only):



                    BrowserModule,
                    BrowserAnimationsModule,
                    LazyLoadImageModule (if using it),
                    CarouselModule (if using it),
                    InfiniteScrollModule (if using it),
                    HttpModule ( if using it)






                    share|improve this answer




























                      3














                      I also got the same error and finally, after little bit struggle, I was able to fix it.



                      Import these mentioned modules only once(in app-module only):



                      BrowserModule,
                      BrowserAnimationsModule,
                      LazyLoadImageModule (if using it),
                      CarouselModule (if using it),
                      InfiniteScrollModule (if using it),
                      HttpModule ( if using it)






                      share|improve this answer


























                        3












                        3








                        3







                        I also got the same error and finally, after little bit struggle, I was able to fix it.



                        Import these mentioned modules only once(in app-module only):



                        BrowserModule,
                        BrowserAnimationsModule,
                        LazyLoadImageModule (if using it),
                        CarouselModule (if using it),
                        InfiniteScrollModule (if using it),
                        HttpModule ( if using it)






                        share|improve this answer













                        I also got the same error and finally, after little bit struggle, I was able to fix it.



                        Import these mentioned modules only once(in app-module only):



                        BrowserModule,
                        BrowserAnimationsModule,
                        LazyLoadImageModule (if using it),
                        CarouselModule (if using it),
                        InfiniteScrollModule (if using it),
                        HttpModule ( if using it)







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Feb 9 '18 at 16:20









                        user9339378user9339378

                        391




                        391























                            2














                            This error can occur if you have imported BrowseModule in some child.app module.ts also. Please make sure you import CommonModule in all modules other than app.module as it has browser modules.






                            share|improve this answer
























                            • you can import CommonModule from '@angular/common'

                              – Fatema Saifee
                              Aug 31 '17 at 7:55











                            • Still getting the same error. And you can check only in AppModule I have imported BrowseModule

                              – Er Sushil
                              Aug 31 '17 at 8:01











                            • yeah me too, only imported in app module

                              – fdsfdsfdsfds
                              Apr 26 '18 at 12:57
















                            2














                            This error can occur if you have imported BrowseModule in some child.app module.ts also. Please make sure you import CommonModule in all modules other than app.module as it has browser modules.






                            share|improve this answer
























                            • you can import CommonModule from '@angular/common'

                              – Fatema Saifee
                              Aug 31 '17 at 7:55











                            • Still getting the same error. And you can check only in AppModule I have imported BrowseModule

                              – Er Sushil
                              Aug 31 '17 at 8:01











                            • yeah me too, only imported in app module

                              – fdsfdsfdsfds
                              Apr 26 '18 at 12:57














                            2












                            2








                            2







                            This error can occur if you have imported BrowseModule in some child.app module.ts also. Please make sure you import CommonModule in all modules other than app.module as it has browser modules.






                            share|improve this answer













                            This error can occur if you have imported BrowseModule in some child.app module.ts also. Please make sure you import CommonModule in all modules other than app.module as it has browser modules.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 31 '17 at 7:54









                            Fatema SaifeeFatema Saifee

                            397




                            397













                            • you can import CommonModule from '@angular/common'

                              – Fatema Saifee
                              Aug 31 '17 at 7:55











                            • Still getting the same error. And you can check only in AppModule I have imported BrowseModule

                              – Er Sushil
                              Aug 31 '17 at 8:01











                            • yeah me too, only imported in app module

                              – fdsfdsfdsfds
                              Apr 26 '18 at 12:57



















                            • you can import CommonModule from '@angular/common'

                              – Fatema Saifee
                              Aug 31 '17 at 7:55











                            • Still getting the same error. And you can check only in AppModule I have imported BrowseModule

                              – Er Sushil
                              Aug 31 '17 at 8:01











                            • yeah me too, only imported in app module

                              – fdsfdsfdsfds
                              Apr 26 '18 at 12:57

















                            you can import CommonModule from '@angular/common'

                            – Fatema Saifee
                            Aug 31 '17 at 7:55





                            you can import CommonModule from '@angular/common'

                            – Fatema Saifee
                            Aug 31 '17 at 7:55













                            Still getting the same error. And you can check only in AppModule I have imported BrowseModule

                            – Er Sushil
                            Aug 31 '17 at 8:01





                            Still getting the same error. And you can check only in AppModule I have imported BrowseModule

                            – Er Sushil
                            Aug 31 '17 at 8:01













                            yeah me too, only imported in app module

                            – fdsfdsfdsfds
                            Apr 26 '18 at 12:57





                            yeah me too, only imported in app module

                            – fdsfdsfdsfds
                            Apr 26 '18 at 12:57











                            1














                            I had the same problem and Jota.Toledo gave the correct answer and I want only extend that: please check in shared module imports any modules that related with




                            @angular/platform-browser/animations




                            and move those modules into app.module.ts






                            share|improve this answer




























                              1














                              I had the same problem and Jota.Toledo gave the correct answer and I want only extend that: please check in shared module imports any modules that related with




                              @angular/platform-browser/animations




                              and move those modules into app.module.ts






                              share|improve this answer


























                                1












                                1








                                1







                                I had the same problem and Jota.Toledo gave the correct answer and I want only extend that: please check in shared module imports any modules that related with




                                @angular/platform-browser/animations




                                and move those modules into app.module.ts






                                share|improve this answer













                                I had the same problem and Jota.Toledo gave the correct answer and I want only extend that: please check in shared module imports any modules that related with




                                @angular/platform-browser/animations




                                and move those modules into app.module.ts







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Aug 9 '18 at 8:40









                                Vitaliy BilousVitaliy Bilous

                                163




                                163























                                    0














                                    @First Import BrowerModule and in imports also first include BrowserModule import:[BrowerModule ] 

                                    import { BrowserModule } from '@angular/platform-browser';
                                    import { NgModule } from '@angular/core';

                                    import { AppRoutingModule } from './app-routing.module';
                                    import { AppComponent } from './app.component';

                                    @NgModule({
                                    declarations: [
                                    AppComponent
                                    ],
                                    imports: [
                                    BrowserModule,
                                    AppRoutingModule
                                    ],
                                    providers: ,
                                    bootstrap: [AppComponent]
                                    })
                                    export class AppModule { }


                                    If we declare BrowserModule in any module other than app module(Duplicate) this error will come. the In app module if we import 10 modules or plugins, first we have to import BrowserModule at the top and declare in decorates (import:[BrowserModule ]) at the top






                                    share|improve this answer





















                                    • 1





                                      Could you add some explanation to the code?

                                      – Federico Grandi
                                      Nov 22 '18 at 18:07











                                    • 1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

                                      – Brahmmeswara Rao Palepu
                                      Nov 23 '18 at 10:58











                                    • I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

                                      – Federico Grandi
                                      Nov 23 '18 at 15:48
















                                    0














                                    @First Import BrowerModule and in imports also first include BrowserModule import:[BrowerModule ] 

                                    import { BrowserModule } from '@angular/platform-browser';
                                    import { NgModule } from '@angular/core';

                                    import { AppRoutingModule } from './app-routing.module';
                                    import { AppComponent } from './app.component';

                                    @NgModule({
                                    declarations: [
                                    AppComponent
                                    ],
                                    imports: [
                                    BrowserModule,
                                    AppRoutingModule
                                    ],
                                    providers: ,
                                    bootstrap: [AppComponent]
                                    })
                                    export class AppModule { }


                                    If we declare BrowserModule in any module other than app module(Duplicate) this error will come. the In app module if we import 10 modules or plugins, first we have to import BrowserModule at the top and declare in decorates (import:[BrowserModule ]) at the top






                                    share|improve this answer





















                                    • 1





                                      Could you add some explanation to the code?

                                      – Federico Grandi
                                      Nov 22 '18 at 18:07











                                    • 1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

                                      – Brahmmeswara Rao Palepu
                                      Nov 23 '18 at 10:58











                                    • I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

                                      – Federico Grandi
                                      Nov 23 '18 at 15:48














                                    0












                                    0








                                    0







                                    @First Import BrowerModule and in imports also first include BrowserModule import:[BrowerModule ] 

                                    import { BrowserModule } from '@angular/platform-browser';
                                    import { NgModule } from '@angular/core';

                                    import { AppRoutingModule } from './app-routing.module';
                                    import { AppComponent } from './app.component';

                                    @NgModule({
                                    declarations: [
                                    AppComponent
                                    ],
                                    imports: [
                                    BrowserModule,
                                    AppRoutingModule
                                    ],
                                    providers: ,
                                    bootstrap: [AppComponent]
                                    })
                                    export class AppModule { }


                                    If we declare BrowserModule in any module other than app module(Duplicate) this error will come. the In app module if we import 10 modules or plugins, first we have to import BrowserModule at the top and declare in decorates (import:[BrowserModule ]) at the top






                                    share|improve this answer















                                    @First Import BrowerModule and in imports also first include BrowserModule import:[BrowerModule ] 

                                    import { BrowserModule } from '@angular/platform-browser';
                                    import { NgModule } from '@angular/core';

                                    import { AppRoutingModule } from './app-routing.module';
                                    import { AppComponent } from './app.component';

                                    @NgModule({
                                    declarations: [
                                    AppComponent
                                    ],
                                    imports: [
                                    BrowserModule,
                                    AppRoutingModule
                                    ],
                                    providers: ,
                                    bootstrap: [AppComponent]
                                    })
                                    export class AppModule { }


                                    If we declare BrowserModule in any module other than app module(Duplicate) this error will come. the In app module if we import 10 modules or plugins, first we have to import BrowserModule at the top and declare in decorates (import:[BrowserModule ]) at the top







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Nov 23 '18 at 15:48









                                    Federico Grandi

                                    2,99321227




                                    2,99321227










                                    answered Nov 22 '18 at 14:29









                                    Brahmmeswara Rao PalepuBrahmmeswara Rao Palepu

                                    313




                                    313








                                    • 1





                                      Could you add some explanation to the code?

                                      – Federico Grandi
                                      Nov 22 '18 at 18:07











                                    • 1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

                                      – Brahmmeswara Rao Palepu
                                      Nov 23 '18 at 10:58











                                    • I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

                                      – Federico Grandi
                                      Nov 23 '18 at 15:48














                                    • 1





                                      Could you add some explanation to the code?

                                      – Federico Grandi
                                      Nov 22 '18 at 18:07











                                    • 1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

                                      – Brahmmeswara Rao Palepu
                                      Nov 23 '18 at 10:58











                                    • I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

                                      – Federico Grandi
                                      Nov 23 '18 at 15:48








                                    1




                                    1





                                    Could you add some explanation to the code?

                                    – Federico Grandi
                                    Nov 22 '18 at 18:07





                                    Could you add some explanation to the code?

                                    – Federico Grandi
                                    Nov 22 '18 at 18:07













                                    1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

                                    – Brahmmeswara Rao Palepu
                                    Nov 23 '18 at 10:58





                                    1)If we declare BrowserModule in any module other than app module(Duplicate) this error will come.In app module if we import 10 modules or plugins,first we have to import BrowserModule at top and declare in decorates (import:[BrowserModule ]) at top

                                    – Brahmmeswara Rao Palepu
                                    Nov 23 '18 at 10:58













                                    I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

                                    – Federico Grandi
                                    Nov 23 '18 at 15:48





                                    I've edited your answer with that explanation. Please remember to edit your questions and answer instead of just commenting, when possible :)

                                    – Federico Grandi
                                    Nov 23 '18 at 15:48











                                    0














                                    Include all the common modules in parent component only(or appModule only). In child module, include only Child specific modules.



                                    Also, you might need to add
                                    schemas: [NO_ERRORS_SCHEMA], in your child modules and parent modules






                                    share|improve this answer




























                                      0














                                      Include all the common modules in parent component only(or appModule only). In child module, include only Child specific modules.



                                      Also, you might need to add
                                      schemas: [NO_ERRORS_SCHEMA], in your child modules and parent modules






                                      share|improve this answer


























                                        0












                                        0








                                        0







                                        Include all the common modules in parent component only(or appModule only). In child module, include only Child specific modules.



                                        Also, you might need to add
                                        schemas: [NO_ERRORS_SCHEMA], in your child modules and parent modules






                                        share|improve this answer













                                        Include all the common modules in parent component only(or appModule only). In child module, include only Child specific modules.



                                        Also, you might need to add
                                        schemas: [NO_ERRORS_SCHEMA], in your child modules and parent modules







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Dec 31 '18 at 17:56









                                        Shishir AroraShishir Arora

                                        2,59521421




                                        2,59521421























                                            0














                                            If you are using multiple modules, use Browser module only once in your app module or some custom module and use CommonModule from @angular/common in custom modules.



                                            I was getting the same error , I was trying to reuse components, directives, pipes in multiple components/modules. Instead I imported all reusable components in a core module and imported the core module in multiple components/modules.






                                            share|improve this answer






























                                              0














                                              If you are using multiple modules, use Browser module only once in your app module or some custom module and use CommonModule from @angular/common in custom modules.



                                              I was getting the same error , I was trying to reuse components, directives, pipes in multiple components/modules. Instead I imported all reusable components in a core module and imported the core module in multiple components/modules.






                                              share|improve this answer




























                                                0












                                                0








                                                0







                                                If you are using multiple modules, use Browser module only once in your app module or some custom module and use CommonModule from @angular/common in custom modules.



                                                I was getting the same error , I was trying to reuse components, directives, pipes in multiple components/modules. Instead I imported all reusable components in a core module and imported the core module in multiple components/modules.






                                                share|improve this answer















                                                If you are using multiple modules, use Browser module only once in your app module or some custom module and use CommonModule from @angular/common in custom modules.



                                                I was getting the same error , I was trying to reuse components, directives, pipes in multiple components/modules. Instead I imported all reusable components in a core module and imported the core module in multiple components/modules.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Jan 7 at 15:47









                                                Milo

                                                1,89661529




                                                1,89661529










                                                answered Jan 7 at 14:38









                                                Chetan BirajdarChetan Birajdar

                                                278




                                                278






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Stack Overflow!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45975675%2flazy-loading-browsermodule-has-already-been-loaded%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    Ottavio Pratesi

                                                    Tricia Helfer

                                                    15 giugno