title: How to call ajax only once in Angular and Rxjs?
body: <p>There are code:</p>
  
  <pre><code>&lt;button (click)="getData()"&gt;click&lt;button&gt;
  
  getData(){
    this.http.get('/data.json').subscribe(data =&gt; consloe.log(data));
  }
  </code></pre>
  
  <p>or use <strong>post</strong></p>
  
  <pre><code> &lt;button (click)="setData(data)"&gt;click&lt;button&gt;
      getData(){
        this.http.post('/data',{data}).subscribe(res =&gt;consloe.log(res));
      }
  </code></pre>
  
  <p>When I click button many time continuously, it will send many time http requests. How I avoid it? </p>