title: How to use switchmap on service request?
body: <p>I have a form, with a button that will send an email using the contents of the form. I want to use switchmap because I want to prevent the user from spam clicking and creating tons of HTTP requests, but I don't know how to do this.</p>
  
  <p>Before using switchmap:</p>
  
  <pre><code>this.customService.sendEmail(this.emailContents).subscribe(
      data =&gt; { console.log("Success") }
  )
  </code></pre>
  
  <p>Trying to use switchmap:</p>
  
  <pre><code>this.customService.sendEmail(this.emailContents).pipe(
      switchMap(() =&gt; this.customService.sendEmail(this.emailContents))
  )
  .subscribe(
      data =&gt; { console.log("Success") }
  )
  </code></pre>
  
  <p>But now it sends 12 emails when clicking the button 3 times instead of sending 1 email. I think I am using it in the wrong place, but I'm not really seeing how I'm supposed to use it...</p>