根据这个URL,当它到达我的角度控制器时,我需要得到一个值为wonum,这是" BRK18482020"。
http://localhost/RealSuiteApps/RealHelp/-1/Detail?wonum=BRK18482020#/
有可能吗?无法理解......
记录的$ location服务必须有效,但它不起作用:(constructor(private $location: ng.ILocationService) {
var wonum = $location.search().wonum; // DOESNT WORK, wonum undefined
var wonum2 = $location.search()['wonum']; // DOESNT WORK, wonum undefined
无效
更新
显然,angularJS $位置无效。
因此,使用标准方法获得参数可以正常工作。
var wonum = window.location.search.split("wonum=")[1];
答案 0 :(得分:0)
看这篇文章。 Angularjs $location service apparently not parsing url?
您很可能在应用配置中遗失$locationProvider.html5Mode(true);
。另请注意,您的html中需要一个基本标记。 <base href="/baseUrl" />
这也可以回到使用网址中的#
。