diff --git a/angular_app/js/services.js b/angular_app/js/services.js new file mode 100644 index 0000000..d441be9 --- /dev/null +++ b/angular_app/js/services.js @@ -0,0 +1,31 @@ +var eventManServices = angular.module('eventManServices', ['ngResource']); + +eventManServices.factory('Event', ['$resource', + function($resource) { + return $resource('events/:eventID', {eventID: '@eventID'}, { + all: { + method: 'GET', + isArray:true, + transformResponse: function(data, headers) { + return angular.fromJson(data).events; + } + } + }); + }] +); + + +eventManServices.factory('Person', ['$resource', + function($resource) { + return $resource('persons/:personID', {personID: '@personID'}, { + all: { + method: 'GET', + isArray:true, + transformResponse: function(data, headers) { + return angular.fromJson(data).persons; + } + } + }); + }] +); +