Created
December 10, 2013 00:18
-
-
Save johnoscott/7883626 to your computer and use it in GitHub Desktop.
AngularJS $resource usage
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
// Create $resource singleton service with custom methods | |
// SERVICE DebugOrder | |
.factory('Order', ['$resource', '$http', | |
function ($resource, $http) { | |
return $resource(Prefs.getResourceBaseUrl() + '/api/orders/:_id', {}, { | |
'count': {method: 'PUT', params: {_id: 'count'}}, | |
'distinct': {method: 'PUT', params: {_id: 'distinct'}}, | |
'find': {method: 'PUT', params: {_id: 'find'}, isArray: true}, | |
'group': {method: 'PUT', params: {_id: 'group'}, isArray: true}, | |
'mapReduce': {method: 'PUT', params: {_id: 'mapReduce'}, isArray: true}, | |
'aggregate': {method: 'PUT', params: {_id: 'aggregate'}, isArray: true} | |
}); | |
} | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment