Last active
December 10, 2015 01:28
-
-
Save AlexVKO/9c9c5cf8372d295cac36 to your computer and use it in GitHub Desktop.
update com $resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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