Skip to content

Instantly share code, notes, and snippets.

@danilat
Created September 12, 2017 22:04
Show Gist options
  • Save danilat/055f28295d68367a5a45ecc7daeeb6a4 to your computer and use it in GitHub Desktop.
Save danilat/055f28295d68367a5a45ecc7daeeb6a4 to your computer and use it in GitHub Desktop.
var AngularHttpClient = function($http){
var httpClient = new HttpClient();
httpClient.get = function (url) {
return new Promise(function (resolve, reject) {
$http.jsonp(url +'?callback=JSON_CALLBACK')
.success(function(data){
resolve({body: data});
})
.error(function(data){
reject({body: data});
});
});
}
return httpClient;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment