Hello I have problem, I try add to several pages my Header Components (Ionic g component). My Header componet have a 4 files: html,scss,spec.ts and ts. When I add this component to minimum 2 pages I get this error:
Error: Type HeaderComponent is part of the declarations of 2 modules: Tab1PageModule and ProductPageModule! Please consider moving HeaderComponent to a higher module that imports Tab1PageModule and ProductPageModule. You can also create a new NgModule that exports and includes HeaderComponent then import that NgModule in Tab1PageModule and ProductPageModule.
Error: Type HeaderComponent is part of the declarations of 2 modules: Tab1PageModule and ProductPageModule! Please consider moving HeaderComponent to a higher module that imports Tab1PageModule and ProductPageModule. You can also create a new NgModule that exports and includes HeaderComponent then import that NgModule in Tab1PageModule and ProductPageModule.
Its my component look like this:
import { HeaderComponent } from './../../partials/header/header.component';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { ProductPage } from './product.page';
const routes: Routes = [
{
path: '',
component: ProductPage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
entryComponents:[HeaderComponent],
declarations: [ProductPage,HeaderComponent]
})
export class ProductPageModule {}
I try several ways too add this component but I still stay on the same point. On one page works well.
I will be very greatful for help