title: how to use angular service inside rxjs retryWhen method
body: <p>I am making the http service calls 3 times when i get 401 error using the retryWhen method form Rxjs operators. My problem is when i get 401 error as status i need to make other service to get the token updated and then re-try the http service call 3 times . I am unable to use service inside retryWhen call back method as it always showing this as undefined . Can you please provide me solution for this.</p>
  
  <pre><code> return this.http.get(url, this.getOptions(options)).retryWhen(errors =&gt; {
         return errors.mergeMap((error) =&gt; {
              console.error('error status....', this, error, error.status);
              if (error.status === 401) {
                  // i need to make other service call here 
                  this.httpPollingService.updateToken(); // unable to call this call.
                  return Observable.of(error);
              } else {
                  return Observable.throw(error);
              }
          }).delay(5000).take(2);
      });
  </code></pre>