Skip to content

Instantly share code, notes, and snippets.

@AlexVKO
Last active December 10, 2015 01:28
Show Gist options
  • Select an option

  • Save AlexVKO/9c9c5cf8372d295cac36 to your computer and use it in GitHub Desktop.

Select an option

Save AlexVKO/9c9c5cf8372d295cac36 to your computer and use it in GitHub Desktop.
update com $resources
// Apenas com isso...
$resource('/notes/:id', null,
{
'update': { method:'PUT' }
});
// Ele te da todas essas funções
{
'get': {method:'GET'},
'save': {method:'POST'},
'query': {method:'GET', isArray:true},
'remove': {method:'DELETE'},
'delete': {method:'DELETE'}
'update': {method:'PUT'}
};
// No minimo vc deixou de fazer 6 funções a mais com o $http...
// Como dito, para aplicações restful, onde vc precisa de todos os verbos e tipos de requisições basicas, sem muita
// customizacão, é muito mais produtivo usar $resource. E colocar um PUT nele não é gambiarra.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment