Skip to content

Instantly share code, notes, and snippets.

@pinalbhatt
Last active August 29, 2015 14:17
Show Gist options
  • Save pinalbhatt/f7fe3b8f95e87ee6220a to your computer and use it in GitHub Desktop.
Save pinalbhatt/f7fe3b8f95e87ee6220a to your computer and use it in GitHub Desktop.
AngularJS $http get call
$http.get(baseApiUrl + partialUrl, {
params: parms;
})
.success(function (result, status, headers, httpconfig) {})
.error(function (result, status, headers, httpconfig) {});
//Function
function makeGetCall(url, parms) {
var deferred = $q.defer();
$http.get(url, {
params: parms;
})
.success(function (result, status, headers, httpconfig) {
deferred.resolve(result);
})
.error(function (result, status, headers, httpconfig) {
deferred.reject(result, status, headers, httpconfig);
});
return deferred.promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment