angularjs – 是否有内置的方式来获取当前的URL,没有任何查询参
发布时间:2020-12-17 07:46:21 所属栏目:安全 来源:网络整理
导读:如果我的网址是http://www.something.com/foo/bar/index.html?color=yellowu0026amp;animal=rat,好像是: $location.path()将返回foo / bar / index.html $location.absUrl()会返回http://www.something.com/foo/bar/index.html?color=yellowu0026amp;anim
如果我的网址是http://www.something.com/foo/bar/index.html?color=yellowu0026amp;animal=rat,好像是:
> $location.path()将返回foo / bar / index.html 有什么功能将返回http://www.something.com/foo/bar/index.html? 或者我必须使用protcol,host,port等功能来构建自己(或者剥离自己的查询参数)?
据我所知,你必须自己构建它.不是你在问如何构造它,而是那些想知道的人:
var url = $location.absUrl().split('?')[0] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |