$location.path()

path([path]);

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.

// given url http://example.com/#/some/path?foo=bar&baz=xoxo
var path = $location.path();
// => "/some/path"

Parameters

Param Type Details
path
(optional)
stringnumber

New path

Returns

string

path

doc_AngularJS
2016-03-29 16:10:29
Comments
Leave a Comment

Please login to continue.