0
我想使用uiRouter获取当前URL查询的url路径。Angular 1 uiRouter如何通过url查询获取完整路径?
我想实现的是类似的东西:通过uiRouter window.location.pathname + window.location.search
一个将如何实现这一目标?
我试过控制台日志记录$location
但path
没有带来url查询,只是路径。
我想使用uiRouter获取当前URL查询的url路径。Angular 1 uiRouter如何通过url查询获取完整路径?
我想实现的是类似的东西:通过uiRouter window.location.pathname + window.location.search
一个将如何实现这一目标?
我试过控制台日志记录$location
但path
没有带来url查询,只是路径。
你可以尝试使用下面的代码来获得完整的网址与所有细分。
// given URL http://yoururl.com/#/some/path?val1=bar&val2=xoxo
var absUrl = $location.absUrl();
// "http://yoururl.com/#/some/path?val1=bar&val2=xoxo"
感谢
'$ location.url()' – ChrisG