Reputation: 1063
My application have a url like this: "http://host:port/mySystem?x.system
"
The x.system had to be added because a legacy application need this stuff on all url's, and my application depends on this legacy application.
My problem is that i need the pure url of the system like this : "http://host:port/mySystem
", but when i use $location.absUrl() it returns : "http://host:port/mySystem?x.system
"
There's a way to get the url with $location (or another service on angular), without the parameters ?
Upvotes: 1
Views: 1104
Reputation: 14219
You can use $location
to pull out whatever you need to build a URL. Here is a Plunker from the official docs that shows all the different parts. You probably want something like this:
function buildBaseUrl() {
return $location.protocol() + '://' + $location.host() + ':' + $location.port() + $location.path()
}
Upvotes: 2