When i start the angular application i get the following error,
Error: Template parse errors:
'router-outlet' is not a known element
.....
ng:///LayoutModule/LayoutComponent.html
app.module.ts
@NgModule({
declarations: [
AppComponent
],
imports: [
...
AppRoutesModule,
LayoutModule,
...
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app-routes.module.ts
@NgModule({
imports: [
RouterModule.forRoot(routes)
],
exports: [
RouterModule
],
declarations: []
})
export class AppRoutesModule{ }
layout.module.ts
@NgModule({
imports: [],
declarations: [LayoutComponent, HeaderComponent]
})
export class LayoutModule { }
I did not import RouterModule in LayoutModule intentionally because the AppRoutesModule exports it already which should be available in the LayoutModule.
Is there any reason why it's not working?