title: Typescript : pass a method as a parameter of another method
body: <p>Within my <strong>angular</strong> app I have this treatment :</p>
  
  <pre><code>this.myServiceOne.getDataOne().subscribe((res =&gt; {this.variableOne= res}));
  this.myServiceTwo.getDataTwo().subscribe((res =&gt; {this.variableTwo= res}));
  this.myServiceThree.getDataThree().subscribe((res =&gt; {this.variableThree= res}));
  this.myServiceFour.getDataFour().subscribe((res =&gt; {this.variableFour= res}));
  </code></pre>
  
  <p>My purpose is to make a generic function in this way:</p>
  
  <pre><code>  loadData(myVariable, myserviceMethod){
      serviceMethod().subscribe((res =&gt; {pefVar = res}));
    }
  </code></pre>
  
  <p>and replace my treatment like this :</p>
  
  <pre><code>this.loadData(this.variableOne, this.myServiceOne.getDataOne);
  </code></pre>
  
  <p>But this seems to not work and it can't understand this injection : <strong>(this.myServiceOne.getDataOne)</strong></p>
  
  <p><strong>Your suggestions ?</strong></p>