title: How to excute a function in x component from y component?
body: <p>I have a component <code>alphabatesComponent</code>. It has a method <code>postLetters()</code>. I want to call <code>wordsComponent</code> listOfAlphabates() method whenever I call <code>postLetters()</code> in <code>alphabatesComponent</code>.</p>
  
  <p>// Service </p>
  
  <pre><code>private _listners = new Subject&lt;any&gt;();
  constructor(private httpClient: HttpClient) { }
  
  listen(): Observable&lt;any&gt; {
      debugger;
     return this._listners.asObservable();
  }
  
  filter(filterBy: string) {
      debugger;
     this._listners.next(filterBy);
  }
  </code></pre>
  
  <p>// alphabates component</p>
  
  <pre><code>export class alphabatesComponent {
    postLetters(): void {
      this.asynService.filter('Register click');
    }
  }
  </code></pre>
  
  <p>// this is my words component</p>
  
  <pre><code>constructor() {
  this.asyncService.listen().subscribe((m: any) =&gt; {
    this.listOfAlphabates();
   }
  }
   listOfAlphabates() {}
  </code></pre>
  
  <p>}</p>