Created
June 12, 2013 14:53
-
-
Save mockguiver/5766000 to your computer and use it in GitHub Desktop.
Angular JS - $resource - Avoid CORS using JSONP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demonstrate how to register services | |
// In this case it is a simple value service. | |
angular.module('myBeerApp.services', ['ngResource']). | |
value('version', '0.1'). | |
factory('beerDB', function($resource) { | |
return $resource('URL',{ | |
alt:'json', | |
appToken:'TOKEN', | |
q:'rock', | |
callback: 'JSON_CALLBACK' | |
}, | |
{ | |
get: { | |
method:'JSONP', | |
headers: { | |
'Content-Type': 'application/json', | |
'Accept': 'application/json' | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment