title: How to call child components's method from the parent component in Angular 6
body: <blockquote>
    <p>Parent Component</p>
  </blockquote>
  
  <pre><code>import { Component } from '@angular/core';
  import { ChildComponent }  from './notify.component';
  
  @Component({
      selector: 'my-app',
      template:
      `
      &lt;button (click)="submit()"&gt;Call Child Component Method&lt;/button&gt;
      `
  })
  export class AppComponent {
      constructor(private childComp: ChildComponent) { 
      }
  
      submit(): void {
          // execute child component method
          // This line is compiled properly but at the run time it gives me error related to the static injector## Heading ##
          childComp.callMethod();
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Child component</p>
  </blockquote>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  
  @Component({
      selector: 'child',
      template: '&lt;h3&gt;Child component {{test}}&lt;/h3&gt;'
  })
  export class ChildComponent implements OnInit {
     test:string; 
     constructor() { }
  
      ngOnInit() { }
  
      callMethod(): void {
          console.log('successfully executed.');
          this.test = 'Me';
      }
  }
  </code></pre>
  
  <p>I am getting an error for the static injector, I am not able to inject the child component in the parent component. Here is the error.</p>
  
  <blockquote>
    <p>StaticInjectorError(AppModule)[AppComponent -> ChildComponent]:
    StaticInjectorError[ChildComponet]: 
            NullInjectorError: No provider for ChildComponet!</p>
  </blockquote>
  
  <p>I have added the reference in the Appmodule and added the component in the declaration. Still, I am facing the same issue.</p>
  
  <p>Please Help!!</p>