title: How to append query string to url in AngularJS?
body: <p>I am new to angular js. I have search page with input text box to search for customerId but I want to add a functionality where I can search based on url string as well.</p>
  
  <p>For example,  My url is : </p>
  
  <pre><code>http://localhost:8080/#/search
  </code></pre>
  
  <p>But I need something like </p>
  
  <pre><code>http://localhost:8080/#/search?ACC34ff 
  </code></pre>
  
  <p><a href="http://localhost:8080/#/search?CustomerId" rel="nofollow noreferrer">http://localhost:8080/#/search?CustomerId</a> so that I can search based on customerId in url also</p>
  
  <p>Can some one tell how can I add query string ? </p>
  
  <pre><code>app.config(['$routeProvider',
  function($routeProvider) {
      $routeProvider
      .when('/home', {
          templateUrl: 'partials/home.html',
          controller: 'homePageCtrl',
          reloadOnSearch: true
      }).when('/features', {
          templateUrl: 'partials/features.html',
          controller: 'featuresCtrl',
          reloadOnSearch: false
      }).when('/search', {
          templateUrl: 'partials/search.html',
          controller: 'searchCtrl',
          reloadOnSearch: false
      }).otherwise({
          redirectTo: '/home'
      });
  }]);
  </code></pre>
  
  <p>Controller :</p>
  
  <pre><code>appControllers.controller('searchCtrl', ['$scope','$route','$filter', '$http', '$location','$window','$timeout',
      function($scope, $route, $filter, $http, $location, $window, $timeout) {
  
          $scope.searchCustomerFeatures = function () {
  
              if($scope.customerId != null) {
  
              $http.get('/getCustomerFeatures.do', {params: {'customerId': $scope.customerId}}).success(function (data) {
  
                  $scope.featuresJson = angular.toJson(data, true);
                  });
              }
          }
      }]);
  </code></pre>
  
  <p>Html :</p>
  
  <pre><code>  &lt;li ng-class="{active: isActive('/search')}" style="margin-left: 100px; text-decoration-color: black; font-size: 20px"&gt;
              &lt;a href="#search" role="tab" data-toggle="tab"&gt;Search&lt;/a&gt;
          &lt;/li &gt;
  </code></pre>
  
  <p>Search page :</p>
  
  <p></p>
  
  <p>Thanks</p>