title: How to pass multiple parameters in http GET request in Angular?
body: <p>I am using below method to pass multiple parameters in http get request but it is giving me an error -</p>
  
  <pre><code>import { HttpParams, HttpClient } from '@angular/common/http';
  
  constructor(private http: HttpClient) { }
  
  let params = new HttpParams();
  params = params.append('var1', val1);
  params = params.append('var2', val2);
  
  this.http.get(StaticSettings.BASE_URL, {params: params}).subscribe(...);
  </code></pre>
  
  <p><strong>ERROR</strong> - Cannot redeclare block-scoped variable 'params'</p>
  
  <p>If I change the name then how can I call it inside the URL ?</p>
  
  <p>As a workaround, I thought of appending the parameters directly in the URL instead as follows-</p>
  
  <pre><code>this.params1 = 'parameter1';
  this.params2 = 'parameter2';
  this.params3 = 'parameter3';
  </code></pre>
  
  <p>http request -</p>
  
  <pre><code>return this.http.get('URL/json?'+'&amp;parameter1='+this.params1+'&amp;parameter2='+this.params2+'&amp;parameter3='+this.params3)
  </code></pre>
  
  <p>I got this ERROR - </p>
  
  <p><code>Access to XMLHttpRequest at 'URL/json?'+'&amp;parameter1='+this.params1+'&amp;parameter2='+this.params2+'&amp;parameter3='+this.params3' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.</code></p>
  
  <p>To check if the URL got appended correctly I clicked on the url in the error and it worked properly.</p>
  
  <p>Can anyone please help me resolve this? </p>
  
  <p>Thanks !!</p>