Angularjs $location service apparently not parsing url?

前端 未结 5 1735
你的背包
你的背包 2020-12-09 01:53

I\'m using angular in an application which is, basically, a table with search results. Access to this table can be achieved via an url like http://myapp/?client=clien

5条回答
  •  无人及你
    2020-12-09 02:39

    The API for $location.search is pretty confusing. Calling

    $location.search('client');
    

    will set the search object to {client: true} and return $location. Furthermore, you have a typo client instead of 'client', so it's setting search to an empty object. So you probably want:

    url += '&client=' + $location.search()['client'];
    

提交回复
热议问题