angularjsngrouteangularjs-ng-route

How to ignore route param in location


I am navigating to next page as:

$location.path("XXX/YYYY/");

current view has URL parameter as:

http://www.go.com/?a=true;

now when I navigate, it has XXX/YYYY/"?a=true;

I have tried :

delete $routeParams.a;

and

delete $location.$$search.a;

But it doesn't work. It doesn't remove the parameter.

How to set routeparam when navigating to a different page?


Solution

  • Following change fixed my issue :

     delete $location.$$search.a;
     $location.replace().path("XXX/YYYY/");
    
     config: {           
                reloadOnSearch: false
             }