title: Passing query param to api in Angular
body: <p>I have a child component, in which, after button press it pass a form field to a father component. I have to pass this fields as query Params to an <code>API GET /valuation/</code> that require more or less 20 optional parameters, in which the name differs from Input fields.</p>
  <p>I created a temporary object <code>res</code> inside the father function accept in which I iterate the field . Still I can't figure how to pass this parameter inside the object <code>res</code>, using multiple <code>if</code> is dirty code.</p>
  <p>for example
  Function in father component</p>
  <pre><code>    accept(form:any){
          const req: any = {};
          if(form.name)
            req.user = form.name
          if(form.address)
            req.clusterAddress = form.address
         ... and so on x 20 times
  
  this.requestService.getRequest(req).subscribe(
        (response) =&gt; {
          this.getRequest(response);
        }, (error) =&gt; {
          console.error(error);
        }
        }
  </code></pre>
  <p>As you can see this is not a viable option, what I can use to take dynamically the query param names?</p>