One efficient way to ensure consistency across page modules in Angular is by creating a shared module and using it as an import for pages that require the header component:
Create a file named shared.module.ts and add the following code:
import { NgModule } from '@angular/core';
import { CommonModule} from '@angular/common';
import { HeaderComponent} from './header/header.component';
import { IonicModule} from '@ionic/angular';
@NgModule({
imports: [
CommonModule,
IonicModule
],
declarations: [HeaderComponent],
exports: [HeaderComponent]
})
export class SharedModule {}
In your home.module.ts file, include the SharedModule in the imports array like this:
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SharedModule,
RouterModule.forChild(routes),
],
declarations: [HomePage]
})
export class HomePageModule {}