As the error description is self-evident, the module for which you want to implement lazy loading should not import the BrowserModule, as it has already been imported earlier (mainly in app.component). You should only import the BrowserModule once. Other modules should import CommonModules instead.
See the code below for an 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 faced the same problem. Where I have a CommonModule with the same name angular one. So this was really a problem for me, because I did not know that there was another "CommonModule" in angular itself. I found this blog helpful. By sending a response from there.
Partha sarathi ghosh
source share