title: How to access a method from app.component from other component?
body: <p>I am new to Typescript and Angular 2.  I tried to look for an answer in the web but it seems they don't work for me.</p>
  
  <p>Say I have an app.component as shown below:</p>
  
  <pre><code>export class AppComponent implements OnInit {
  
      constructor(public _testService: TestService) { }
  
      listForCart = this._testService.getListForCart();
      cartCount = this.listForCart.length;
      cartPayableAmount = 0;
  
      ngOnInit() {
          this.computeTotal();
      }
  
      TestingFunction(){
          console.log("Got here");
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Now I want to access the TestingFunction in my app.component in other class as shown below:</p>
  
  <pre><code>export class BuyTestComponent {
  
      constructor(private _testService: TestService) {
      }
  
      public pageTitle: string = "ALL PRACTICE TEST SERIES";
  
      TestHere() {
          // should call TestingFunction() here.....
      }
  }
  </code></pre>
  
  <p>How to do that? Please help</p>