title: Build query string from parameters object
body: <p>How to build a url with query parameters in Angularjs.</p>
  
  <p>I see the API <a href="http://docs.angularjs.org/api/ng.%24location">$location.search()</a></p>
  
  <p>the problem is $location(url) is to redirect to the url. In my case, I want to pass a url and key:value pairs for the query params and build the url. something like</p>
  
  <p>url: <code>/a/b/c</code>
  params: <code>{field1: value1, field2: value2}</code></p>
  
  <p>result: <code>/a/b/c?field1=value1&amp;field2=value2</code></p>
  
  <p>I like to use this url for links. I have also seen angular encode <code>?</code> , <code>&amp;</code> characters. Can I avoid this?</p>
  
  <h2>Edit:</h2>
  
  <p>My intention was to use the url as href for anchor elements. I do use $http to send the request, but sometimes I need to provide a link, with query params (based on the current object) </p>
  
  <p>Thanks</p>