I\'ve updated my application to RC6 and now i keep getting this error:
zone.js:484 Unhandled Promise rejection: BrowserModule has already been loade
As the error description is self-explanatory, the module for which you want to implement lazy loading shouldn’t import BrowserModule
as this is already been imported earlier (mainly in app.component). You should only import BrowserModule
once. Other modules should be importing CommonModules
instead.
See the code below for understanding
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; //<-- This one
import { SearchMovieMainComponent } from './search-movies-main.component';
@NgModule({
imports: [
CommonModule //<-- and this one
],
declarations: [
SearchMovieMainComponent
]
})
export class SearchMoviesMainModule {
}
Note: This is not my own answer. I was facing the same problem. Where I myself have a CommonModule
in the same name of angular one. So it was real a problem for me, as I was not aware that there is another CommonModule
that exists in angular itself. I found this blog helpful. Posting the answer from there.