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

前端 未结 3 1065
长发绾君心
长发绾君心 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:40

    You can also do:

    var search = $location.search();
    if (search.parameter == 'null') {
      $location.search({'parameter': null});
    }
    

提交回复
热议问题