title: Angular: How to call component method from another component in different modules
body: <p>I am trying to call a method of A_Component owned by A_Module from B_Component owned by B_Module and am getting the following error as soon as I add A_Component as a parameter to the B_Component constructor:</p>
  
  <blockquote>
    <p>NullInjectorError: No provider for A_Component!</p>
  </blockquote>
  
  <p>EDIT: The two components are not parent/child. Their modules are imported by app.module</p>
  
  <p>(Code summarized for brevity)</p>
  
  <p>A_Module:</p>
  
  <pre><code>import { A_Component } from '...'
  
  @NgModule({
      imports: [...],
      declarations: [A_Component],
      exports: [A_Component],
  })
  
  export class A_Module { }
  </code></pre>
  
  <p>B_Module:</p>
  
  <pre><code>import { A_Module } from '...'
  import { B_Component } from '...'
  
  @NgModule({
      imports: [A_Module],
      declarations: [B_Component]
  })
  
  export class B_Module { }
  </code></pre>
  
  <p>A_Component:</p>
  
  <pre><code>export class A_Component {
      someMethod() {...}
  }
  </code></pre>
  
  <p>B_Component:</p>
  
  <pre><code>import { A_Component } from '...'
  
  export class B_Component {
  
      constructor(public a_Component: A_Component)) {} //this param causes error
  
      callSomeMethod() {
          this.a_Component.someMethod();
      }
  }
  </code></pre>
  
  <p>Is this not how to call component methods across modules? Is the only way to do this is with a service?</p>