Skip to content

Instantly share code, notes, and snippets.

@whisher
Last active December 20, 2015 10:08
Show Gist options
  • Save whisher/6112868 to your computer and use it in GitHub Desktop.
Save whisher/6112868 to your computer and use it in GitHub Desktop.
services.factory('RecipeLoader',function(Recipe, $q) {
return function() {
var delay = $q.defer();
Recipe.query({id: 1}, function(recipe) {
delay.resolve(recipe);
}, function() {
delay.reject('Unable to fetch recipe ' + 1);
});
return delay.promise;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment