Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between $location.path(redirecturl) and $location.url(redirecturl)?

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

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.

like image 521
Jay Jay Jay Avatar asked Jan 08 '23 20:01

Jay Jay Jay


1 Answers

The difference is in the getter of the $location.url() and the $location.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).

You can read more about at $location docs

like image 186
Sebastian Sandberg Avatar answered Jan 10 '23 08:01

Sebastian Sandberg