I am a new of Angular. I created header, footer and sidebar. And I was create dashboard component if I use in this dishoard component its works good. So it is working in component. then I created a module for employee. if i use Header Footer Sidebar in this employee module means its shows error
1
src/app/employee/list-employee/list-employee.component.ts:5:16
5 templateUrl: './list-employee.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component ListEmployeeComponent.
Error: src/app/employee/list-employee/list-employee.component.html:2:1 - error NG8001: 'app-sidebar' is not a known element:
1. If 'app-sidebar' is an Angular component, then verify that it is part of this module.
2. If 'app-sidebar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
2 <app-sidebar></app-sidebar>
src/app/employee/list-employee/list-employee.component.ts:5:16 5 templateUrl: './list-employee.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component ListEmployeeComponent.
Error: src/app/employee/list-employee/list-employee.component.html:514:9 - error NG8001: 'app-footer' is not a known element:
514 ~~~~~~~~~~~~
src/app/employee/list-employee/list-employee.component.ts:5:16 5 templateUrl: './list-employee.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component ListEmployeeComponent.
Please help me to sort out this error.
If you put these components in a separate module, you can import it in all the other parts of your app that use the sidebar, header and footer.
@NgModule({
declarations: [
SidebarComponent,
HeaderComponent,
FooterComponent
],
exports: [
SidebarComponent,
HeaderComponent,
FooterComponent
]
})
export class LayoutModule { }
And in the employee module you can do something like this:
@NgModule({
declarations: [
// ...
],
imports: [
// ...
LayoutModule,
],
})
export class EmployeeModule {}