I have created a component called commonmod.component.ts that I am including in two other modules (abc and def).
abc.module.ts
import { commonmod } from '../commonmod/commonmod.component';
@NgModule({
declarations: [
commonmod
]
})
def.module.ts
import { commonmod } from '../commonmod/commonmod.component';
@NgModule({
declarations: [
commonmod
]
})
When I redirect one page in abc module to another page in def module, it is throwing me following error.
ERROR Error: Uncaught (in promise): Error: Type commonmod is part of the declarations of 2 modules: abcand def! Please consider moving commonmod to a higher module that imports abc and def. You can also create a new NgModule that exports and includes commonmodthen import that NgModule in abcand def. Error: Type commonmod is part of the declarations of 2 modules: abc and def! Please consider moving commonmodto a higher module that imports abcand def. You can also create a new NgModule that exports and includes commonmod then import that NgModule in abc and def.