Jay*_*Jay 4 javascript angularjs
我在谈论两者的setter方法而不是getter方法
对于我$ location.url 并不总是需要一段时间来重定向所以我想使用$ location.path但我想知道差异.
小智 5
所不同的是在的吸气剂$location.url()
和$location.path()
url()getter以形式返回路径,搜索和哈希/path?search=a&b=c#hash
,而path()
只返回/path
.
在重定向方面,如果它只是一个路径,那么我会使用
$location.path(redirectpath).
Run Code Online (Sandbox Code Playgroud)