title: Component is part of the declarations of 2 modules in Angular
body: <p>I have created a component called <strong>commonmod.component.ts</strong> that I am including in two other modules (abc and def).</p>
  
  <p><strong>abc.module.ts</strong></p>
  
  <pre><code>import { commonmod } from '../commonmod/commonmod.component';
  @NgModule({
    declarations: [
      commonmod
    ]
  })
  </code></pre>
  
  <p><strong>def.module.ts</strong></p>
  
  <pre><code>import { commonmod } from '../commonmod/commonmod.component';
  @NgModule({
    declarations: [
      commonmod
    ]
  })
  </code></pre>
  
  <p>When I redirect one page in abc module to another page in def module, it is throwing me following error.</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>