Skip to content

Instantly share code, notes, and snippets.

@crossdjinn
Created August 4, 2018 02:57
Show Gist options
  • Save crossdjinn/8ce36d93ca908667b1ef309b2c393f20 to your computer and use it in GitHub Desktop.
Save crossdjinn/8ce36d93ca908667b1ef309b2c393f20 to your computer and use it in GitHub Desktop.
Angular (1.6.8) example of "TRACKS" API
angular.module('app',[])
.factory('TRACKS', ['$resource',
function($resource) {
return $resource('/api/tracks/:id', {id: '@_id'}, {
'query': {method:'GET', isArray:true},
'get': {method:'GET'},
'update': {method:'PUT'},
'save': {method:'POST'},
'remove': {method:'DELETE'},
'delete': {method:'DELETE'}
});
}
]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment