$ location.path(redirecturl)和$ location.url(redirecturl)有什么区别? [英] What is the difference between $location.path(redirecturl) and $location.url(redirecturl)?

查看:166
本文介绍了$ location.path(redirecturl)和$ location.url(redirecturl)有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我说的是两者的setter方法而不是getter方法

I am talking about the setter methods for both and not the getter method

对于我$ location.url 并不总是需要一段时间重定向,所以我想使用$ location.path,但我想知道区别。

For me $location.url doesnt always takes a while to redirect so i was thinking of using $location.path but I wanted to know the difference.

推荐答案

区别在于 $ location.url()的getter和 $ location.path()

The difference is in the getter of the $location.url() and the $location.path()

url()getter以 / path?search = a& b = c #hash 的形式返回路径,搜索和哈希,而as path()只返回 / path

The url() getter returns path, search and hash in the form of /path?search=a&b=c#hash , while as path() will only return /path.

在重定向方面,如果它只是一个路径,那么我会使用

In terms of redirection, if it is only to a path, then yes I would use

$location.path(redirectpath).

您可以在 $ location docs

You can read more about at $location docs

这篇关于$ location.path(redirecturl)和$ location.url(redirecturl)有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆