title: Angular: pass a method as parameter
body: <p>I have these two methods which are almost similar:</p>
  
  <pre><code>private firstFunction () {
      this.serviceOne.methodOne().subscribe(
        res =&gt; {
          return  resultOne = res;
        },
        err =&gt; {}
      );
    }
  
  private secondFunction () {
      this.serviceTwo.methodTwo().subscribe(
        res =&gt; {
          return  resultTwo = res;
        },
        err =&gt; {}
      );
    }
  </code></pre>
  
  <p>I want to write a generic function, like this:</p>
  
  <pre><code>genericFunction (service ,method , result  ) {
          service.method().subscribe(
            res =&gt; {
              return  result = res;
            },
            err =&gt; {}
          );
        }
  </code></pre>
  
  <p>And consequently I want to get something like this working:</p>
  
  <pre><code>genericFunction (serviceOne , methodOne , resultOne );
  genericFunction (serviceTwo , methodTwo , resultTwo );
  </code></pre>
  
  <p>Actually, I cannot find how to pass <code>methodOne</code> and <code>methodTwo</code> as params. Any sugestions?</p>