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