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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With