My AngularJS application needs to have access to the user\'s LinkedIn profile. In order to do that I need to redirect the user to a LinkedIn URL which contains a callback re
If you are using routes parameters just clear $routeParams
$routeParams= null;
To clear an item delete it and call $$compose
if ($location.$$search.yourKey) {
delete $location.$$search.yourKey;
$location.$$compose();
}
derived from angularjs source : https://github.com/angular/angular.js/blob/c77b2bcca36cf199478b8fb651972a1f650f646b/src/ng/location.js#L419-L443
If you want to move to another URL and clear the query parameters just use:
$location.path('/my/path').search({});
I can replace all query parameters with this single line: $location.search({});
Easy to understand and easy way to clear them out.
How about just setting the location hash to null
$location.hash(null);
To remove ALL query parameters, do:
$location.search({});
To remove ONE particular query parameter, do:
$location.search('myQueryParam', null);