with $location.search(): how to remove a parameter from the url when it's null

前端 未结 3 1068
长发绾君心
长发绾君心 2021-02-06 20:57

$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

3条回答
  •  难免孤独
    2021-02-06 21:45

    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.

提交回复
热议问题