$location.search()
to set an url
the search parameter which is passed to the search()
is set by a form. selecting and deselecting an element ca
You can use $location.search({})
to clear all at once.
You can also do:
var search = $location.search();
if (search.parameter == 'null') {
$location.search({'parameter': null});
}
Using the $location
service, you can remove the search param by assigning it a null value:
In the case when your parameter is null, in your case 'parameter'
you can remove it from the url by assigning it a null value like;
$location.search('parameter', null);
Hope it helps.