I am trying to load one shared component inside my lazy loaded module.
module. My lazy module imports the SharedModule like that:
// LazyModule
@NgModule({
imports: [
CommonModule,
SharedModule,
RouterModule.forChild(routes)
],
declarations: [
LazyParentComponent
]
})
Inside my SharedModule, I am importing the Angular material components that I need for the MenuComponent which I export as a shared component:
//SharedModule
@NgModule({
imports: [CommonModule],
declarations: [MenuComponent],
exports: [
MatButtonModule,
MatSelectModule,
MatInputModule,
MatOptionModule,
MatToolbarModule,
MenuComponent
]
})
Then in my LazyParentComponent I am using <app-menu></app-menu> which should render the MenuComponent, which I include in the sharedModule.
But if I start this, I always get a lot of errors like Can't bind to 'value' since it isn't a known property of 'mat-select'. or 'mat-toolbar' is not a known element.
It does however work, if I don't use <app-menu></app-menu> but instead use the MatButtons from the MatButtonModule directly.