/ API Reference / ng / service components in ng / $location
path([path]); //用于获取或者设置当前url中的路径
This method is getter / setter.
Return path of current url when called without any parameter.
Change path when called with parameter and return $location.
Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
注意:路径要加前置“/”
eg:
// given url http://example.com/#/some/path?foo=bar&baz=xoxo
var path = $location.path();
// => “/some/path”