Skip to content

Instantly share code, notes, and snippets.

@Djamy
Created November 10, 2015 13:47
Show Gist options
  • Save Djamy/f24b7777487404d42cfe to your computer and use it in GitHub Desktop.
Save Djamy/f24b7777487404d42cfe to your computer and use it in GitHub Desktop.
var services = angular.module('ngdemo.services', ['ngResource']);
services.factory('UsersFactory', function ($resource) {
return $resource('/ngdemo/web/users', {}, {
query: { method: 'GET', isArray: true },
create: { method: 'POST' }
})
});
services.factory('UserFactory', function ($resource) {
return $resource('/ngdemo/web/users/:id', {}, {
show: { method: 'GET' },
update: { method: 'PUT', params: {id: '@id'} },
delete: { method: 'DELETE', params: {id: '@id'} }
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment