【发布时间】:2014-04-27 11:48:31
【问题描述】:
目前,我正在使用 AngularJS html4mode 来提取 URL 参数。我想改用 hashbang 方法,因为我的路由在启用 html4mode 后搞砸了。
使用html4mode提取URL参数,URL为http://127.0.0.1/webroot/start.html?Venue=XXX
$locationProvider的配置代码如下;
$locationProvider.html5Mode(true); //configure $location
在控制器内部;
var url_param = ($location.search()).Venue;
当我尝试转换为 hashbang 时失败了。我现在很茫然
要转换为 hashbang,URL 会是什么样子?需要对控制器和 $locationProvider 的配置进行哪些更改?
非常感谢您的帮助。
【问题讨论】:
标签: javascript angularjs url-parameters