Created
March 28, 2013 18:34
-
-
Save solocommand/5265691 to your computer and use it in GitHub Desktop.
Angular service
This file contains 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
angular.module('modelService', ['ngResource']).factory('ModelService', function ($resource) { | |
return $resource( | |
'/supermodlr/api/:model_name/:action/:pk_id', | |
{ model_name:'@model_name', action : '@action', pk_id: '@pk_id' }, | |
{ | |
'create': { method: 'POST', params: { action: 'create' } }, | |
'read' : { method: 'GET', params: { action: 'read' }, isArray: false }, | |
'update': { method: 'POST', params: { action: 'update' } }, | |
'delete': { method: 'POST', params: { action: 'delete' } }, | |
'query' : { method: 'GET', params: { action: 'query', q: '@query' }, isArray: true } | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment