title: How to send empty string in routeparams in angular Js?
body: <p>Hi I have a form in which I am sending a <code>searched term</code> and <code>category id</code> . It works fine as I am sending both things but if a user does not enter any thing only 'category id' goes, and in back end if <code>searched term</code> is empty all results are display to user. </p>
  
  <p>But if I send an empty string in route params I redirect to my<code>index</code> page. This is my <code>app.js</code> code.</p>
  
  <pre><code>  when('/subcategory/:subcatId/:search', {
                  templateUrl: 'partials/subcategory.html',
                  controller: 'SubCategoriesController'
              }).
  </code></pre>
  
  <p>My form</p>
  
  <pre><code>   &lt;form name="searchCategoryForm"&gt;
                  &lt;div class="col-md-9 col-xs-10 col-sm-10"&gt;
                      &lt;input class="form-control" placeholder="Find your item here...." ng-model="search" type="text" style="color:#09669c;"&gt;
                  &lt;/div&gt;
                  &lt;div class="col-md-2 col-xs-2 col-sm-2"&gt;
                      &lt;a class="btn btn-primary" role="button" href='#/subcategory/{{cats[clicked_category].id}}/{{search}}'&gt; Search&lt;/a&gt;                  
                  &lt;/div&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>My controller.js</p>
  
  <pre><code>$scope.search_term = $routeParams.search;
      $scope.category_id = $routeParams.subcatId;
  
      /* Search category form */
  
  
      $scope.search_category = function () {
          $http({
              method: 'GET',
              url: 'abc',
              params: {"name": $scope.search_term, "category_id": $scope.category_id},
              headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': $rootScope.keyword_auth_token}
          })
                  .success(function (data) {
                      $scope.search_category_result = data.items;
                      console.log($scope.search_category_result);
                      })
                  .error(function (data) {
                      console.log(data);
                  });
      };
      /* Search category form ends here*/
      if ($scope.search_term &amp;&amp; $scope.category_id)
      {
          $scope.search_category();
      }
  </code></pre>