Hello,
I have an Angular web application on "
www.foo.com" with the server API accessible on "
api" subdomain: "
api.foo.com".
I have different environments (dev, staging, prod...) each deployed on their own domain (
www.foo-dev.com,
www.foo-staging.com,
www.foo.com). Server API is always relative to that domain (
api.foo-dev.com,
api.foo-staging.com,
api.foo.com).
I'm trying to specify the subdomain for $resource in Angular services so they can request the service API on the "
api" subdomain.
Actually my services are made this way, and I cannot find a way to tell the resource to use the "
api" subdomain:
myServices.factory("ProductService", ($resource) ->
return $resource("/products/:productId", {productId:"@productId"})
)I'm coming from Rails where we can put a subdomain constraint on any route or URL simply like this:
:constraints => { :subdomain => 'api' }How can this be achieved using Angular $resource please?
Thank you for your help!