I get an error when page is loaded:
compiler.es5.js:1690 Uncaught Error: Type LoginComponent is part of the declarations of 2 modules: LoginModule and AppModule! Please
consider moving LoginComponent to a higher module that imports LoginModule and AppModule. You can also create a new NgModule that exports and includes LoginComponent then import that NgModule in LoginModule and AppModule.
In @NgModule
I have the following declaration:
declarations: [AppComponent, LoginComponent, LanguageComponent]
How to fix this?
In the top of file app.module I have import:
import { LanguageComponent } from './language/language.component';
import { LoginComponent } from "./login/login.component";
Below in section:
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
TranslateModule.forRoot(),
NgbModule.forRoot(),
CoreModule,
SharedModule,
HomeModule,
AboutModule,
LoginModule,
AppRoutingModule,
InMemoryWebApiModule,
LocalStorageModule,
ReactiveFormsModule,
ReCaptchaModule,
TextMaskModule,
MdButtonModule,
MdCheckboxModule
],
declarations: [AppComponent, LoginComponent, LanguageComponent],
providers: [
AuthenticationService,
HiderPipe,
TimerService
],
bootstrap: [AppComponent]
})
exports
of a ngModule. – ReactgularLoginComponent
is declared in 2 modules. I assume that the component will only be used in theLoginModule
so it doesn't make sense declaring it in theAppModule
. Remove it from there. – Alex Florin