title: How to use Angular $location to set my new url location by changing its key-value params dynamically?
body: <p>Let's say I have a RESTful endpoint that accepts a range of facets to query data. Here's a few examples:</p>
  
  <pre><code>example.com/search?type=Doctor&amp;location=Boston,MA&amp;radius=2  
  example.com/search?type=Facility&amp;location=Wayne,NJ&amp;radius=3&amp;gender=f  
  example.com/search?type=Doctor&amp;location=Patterson,NJ
  </code></pre>
  
  <p>My module accepts the query object to perform the search:</p>
  
  <pre><code>console.log(query);
  {
    type:'Doctor',
    location:'Boston,MA',
    radius:'2'
  }
  
  $scope.getSearch = function(query){
    var search = $search.search(query);
    search.getResults(function(results){
      $scope.results = results;
    });
  }
  </code></pre>
  
  <p>These facets are being passed through a local model in a web form:</p>
  
  <pre><code> &lt;input type="text" ng-model="query.location"/&gt;
   &lt;input type="text" ng-model="query.radius"/&gt;
   &lt;button type="button" ng-click="getSearch(query)"&gt;Search&lt;/button&gt;
  </code></pre>
  
  <p>In the success callback of the <code>getResults</code> function, I'm trying to append the query parameters to the URL like in the examples above:</p>
  
  <pre><code>$scope.getSearch = function(query){
    var search = $search.search(query);
    search.getResults(function(results){
      $scope.results = results;
      search.appendQueryToURL(query);
    });
  }
  </code></pre>
  
  <p>How do I append URL parameters dynamically in AngularJS?</p>