Skip to content

Instantly share code, notes, and snippets.

@ronsuez
Created January 7, 2016 03:32
Show Gist options
  • Save ronsuez/7308cfcc9af8ebce93ff to your computer and use it in GitHub Desktop.
Save ronsuez/7308cfcc9af8ebce93ff to your computer and use it in GitHub Desktop.
angular-gists
//http function promise example
function getPackages(){
var deferred = $q.defer();
$http.get(BaseApiUrl + '/packages/')
.success(function(data, status, headers, config) {
deferred.resolve(data.results);
})
.error(function(status) {
deferred.reject(status);
});
return deferred.promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment