$resource is awesome providing very convenient way to handle web services. What if GET and POST have to be performed on different URLs?
For example, GET URL is
You should be able to expose the URL as a parameter. I was able to do this:
$provide.factory('twitterResource', [
'$resource',
function($resource) {
return $resource(
'https://:url/:action',
{
url: 'search.twitter.com',
action: 'search.json',
q: '#ThingsYouSayToYourBestFriend',
callback: 'JSON_CALLBACK'
},
{
get: {
method: 'JSONP'
}
}
);
}
]);
Then you can overwrite the URL on your GET
call.
The one caveat I found during my REALLY brief testing was that if I included http://
in the URL string, it didn't work. I didn't get an error message. It just did nothing.