【发布时间】:2017-03-08 01:37:01
【问题描述】:
我最近开始使用 Angular 开发一个应用程序。
现在,如果我在主控制器(根 url)中使用 location.search(),它可以完美地工作并给我搜索参数。
localhost:8080/app?foo=bar 完美运行。
但是如果我尝试在任何其他控制器中使用location.search(),它会给我未定义的对象。
localhost:8080/app/exampleroute?foo=bar
我不明白为什么会这样。
我是否缺少任何配置。
我已经启用了 html5 模式。
【问题讨论】:
-
我很困惑
location.search()没有抛出错误。在我的浏览器上,我得到TypeError: location.search is not a function。
标签: javascript angularjs location ngroute