title: How to send JWT token as authorization header in angular 6
body: <p>Currently I used this static code in component .ts file but this one is not work. It returns unauthorized(401). But when I pass token as query string it works fine. Please give a working example for component .ts file.</p>
  
  <pre><code>    import { HttpClient, HttpResponse ,HttpHeaders} from '@angular/common/http';
  
  
      var t=`eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXBpXC9sb2dpbiIsImlhdCI6MTUzNzcxNTMyNSwiZXhwIjoxNTM3NzE4OTI1LCJuYmYiOjE1Mzc3MTUzMjUsImp0aSI6IlBKWVhnSkVyblQ0WjdLTDAiLCJzdWIiOjYsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.1vz5lwPlg6orzkBJijsbBNZrnFnUedsGJUs7BUs0tmM`;
  
      var headers_object = new HttpHeaders();
          headers_object.append('Content-Type', 'application/json');
          headers_object.append("Authorization", "Bearer " + t);
  
          const httpOptions = {
            headers: headers_object
          };
  
  
     this.http.post(
                    'http://localhost:8000/api/role/Post', {limit:10}, httpOptions
                   ).subscribe(resp =&gt; {
                    this.roles = console.log(resp)
                    }
                  );
  </code></pre>