title: How to pass userId to headers in Angular
body: <p>I'm trying to pass the userId to the headers in this call:</p>
  
  <blockquote>
    <p>api.service.ts</p>
  </blockquote>
  
  <pre><code>onUpdateJamItMessageBoard( dispMsg: any, dispStartTs: any, dispEndTs: any, userId: any) {
      const url = this.updateJamItMessageBoard + 'messages';
      const params = new HttpParams()
        .set('dispMsg', String(dispMsg))
        .set('dispStartTs', String(dispStartTs))
        .set('dispEndTs', String(dispEndTs));
        const headers = new HttpHeaders({
          'userId': String (userId)
        });
  
  
  return this.http.post&lt;JamIt&gt;(url, null, {
    params: params, headers: headers
    });
  }
  </code></pre>
  
  <p>I'm subscribing to it here: </p>
  
  <blockquote>
    <p>jamit.component.ts</p>
  </blockquote>
  
  <pre><code>onUpdateJamIt() {
      let dispMsg = this.jamItMessageForMessageCenter + ' ' + this.jamItMessage + ' ' + this.freeText;
      let dispStartTs = this.startTimer;
      let dispEndTs = this.endTimer;
      let userId = '';
  
      this.apiEndPointService.onUpdateJamItMessageBoard(dispMsg.trim(), dispStartTs.trim(), dispEndTs.trim(), userId.trim()).subscribe(response =&gt; {
        console.log(response)
      });
  
    }
  </code></pre>
  
  <p>and here's where I use it in the HTML:</p>
  
  <blockquote>
    <p>jamit.component.html</p>
  </blockquote>
  
  <pre><code>&lt;button mat-raised-button color="warn" (click)="onUpdateJamIt()"&gt;Update&lt;/button&gt;
  </code></pre>
  
  <p>
  <br></p>
  
  <p>When I click on the click event, I pass all the other parameters except the UserId and I don't know why. Please help. Am I doing it wrong? Or is there something I'm missing?</p>