title: How to create an RXjs RetryWhen with delay and limit on tries
body: <p>I am trying to make an API call (using angular4), which retries when it fails, using retryWhen.
  I want it to delay for 500 ms and retry again. This can be achieved with this code:</p>
  
  <pre><code>loadSomething(): Observable&lt;SomeInterface&gt; {
    return this.http.get(this.someEndpoint, commonHttpHeaders())
      .retryWhen(errors =&gt; errors.delay(500));
  }
  </code></pre>
  
  <p>But this will keep trying forever. How do I limit it to, let's say 10 times?</p>
  
  <p>Thank you!</p>