title: How will i pass query parameters to REST API inside a service in an angular application?
body: <p>I'm trying to pass query parameters inside a service to a REST API.</p>
  
  <p>Example of how i should pass to API.(EXPECTED)</p>
  
  <pre><code>http://localhost:2000/world/123456789/avengers?type=fruits&amp;fields=_all
  </code></pre>
  
  <p>Have tried as below:</p>
  
  <pre><code>     all(countId) {
          const headers: HttpHeaders = new HttpHeaders({
              "_id" : countId, 
              "content-type" : "application/json"
          });
          let params = new HttpParams();
          params = params.append("type", "fruits");
          params = params.append("fields", "_all");
          const options = {
              headers: headers,
              params: params
          };
          return this.http.put ( "http://localhost:2000/world/123456789/avengers", options )
      }
  </code></pre>
  
  <p>But i am not able to pass them has query parameters.how will i do that?</p>
  
  <p><a href="https://i.stack.imgur.com/LCzuG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LCzuG.png" alt="enter image description here"></a></p>