Angularjs $location service apparently not parsing url?

前端 未结 5 1733
你的背包
你的背包 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:24

    When I encountered this problem, another thing that worked for me besides setting the configuration is to add "#" in front of the query string.

    So if you are the one creating the query string, then changing
    myapp/?client=clientName
    to
    myapp/#?client=clientName

    allowed $location.search() to give me a non-empty object which you can then access each parameter using $location.search()['client']

提交回复
热议问题