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
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')
}]);