basic REST services

This commit is contained in:
Davide Alberani 2015-03-21 13:21:15 +01:00
parent 212ceba267
commit 4e7fff358e

31
angular_app/js/services.js vendored Normal file
View file

@ -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;
}
}
});
}]
);