title: Using shareReplay(1) in Angular - still invokes http request?
body: <p>I've created a demo (<a href="https://ng-run.com/edit/dYatmtw7gNhqHPEthWRn" rel="noreferrer"><strong>ng-run</strong></a>) where I have a button which invokes an Http request.</p>
  
  <p>When the button is clicked, I invoke this method : </p>
  
  <pre><code>public getData(){
   this._jokeService.getData().subscribe();
  }
  </code></pre>
  
  <p>Which in turn invokes this ( from a service) : </p>
  
  <pre><code> public getData() {
      return this.http.get(API_ENDPOINT).pipe(shareReplay(1))
    }
  </code></pre>
  
  <p>The problem is that on every click -  I still see a new http request initiated :</p>
  
  <p><a href="https://i.stack.imgur.com/b3RF1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b3RF1.png" alt="enter image description here"></a></p>
  
  <p><strong>Question:</strong></p>
  
  <p>Why doesn't shareReplay keeps the last value of the response?<br>
  How can I make my code to invoke the http only once and keep that value for future subscriptions  ?</p>
  
  <p>Edit: <a href="https://stackblitz.com/edit/angular-yj3uwk?file=src%2Fapp%2Fapp.component.ts" rel="noreferrer">solution is here</a></p>