I'm using ngResource to consume a RESTful API, and have implemented the following service:
app.factory('User', function($resource) {
return $resource('/api/users/:id', { id: '@id' });
});
I would like to pass in a subdomain to it. Is there a way to do this?
I'm aware of the following workarounds:
- Pass in a full URL:
api.acme.com/users/:id
- Inject a variable on the url: `'api.' + mydomain + '/users/:id'
With that said, I believe it'd be cleaner to just send the subdoman as an argument. Can this be done?