How do I get the current protocol host and port of my current url?
app.factory('actionTypeFactory', ['$resource', function($resource, $location){
return $resource($location.protocol() + '://'+ $location.host() +':'+ $location.port() +'82/somelocation')
}]);
I would like the url to look like this: http:// localhost:80 /somelocation
absUrl(); This method is getter only. Return full URL representation with all segments encoded according to rules specified in RFC 3986.
The protocol property sets or returns the protocol of the current URL, including the colon (:). For the domain you can use: var domain = window. location.
hash() Method: It is a read and writes method of $location service. It returns the current hash value of the current URL when called without parameters and when called with parameters it returns the$location object.
If the user is maximizing it the first time, share the url to this maximized view with the maximizedWidgetId on the UI. As long as you use $location(which is just a wrapper over native location object) to update the path it will refresh the view. Not only $location will refresh the view.
You must inject the $location service, that's why it is undefined:
app.factory('actionTypeFactory', ['$resource', '$location', function($resource, $location){
return $resource($location.protocol() + '://'+ $location.host() +':'+ $location.port() +'82/somelocation')
}]);
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