eventman/angular_app/js/services.js

33 lines
882 B
JavaScript
Raw Normal View History

2015-03-21 13:21:15 +01:00
var eventManServices = angular.module('eventManServices', ['ngResource']);
eventManServices.factory('Event', ['$resource',
2015-03-21 15:45:40 +01:00
function($resource) {
return $resource('events/:id', {id: '@id'}, {
all: {
method: 'GET',
isArray: true,
transformResponse: function(data, headers) {
return angular.fromJson(data).events;
}
},
update: {method: 'PUT'}
});
}]
2015-03-21 13:21:15 +01:00
);
eventManServices.factory('Person', ['$resource',
2015-03-21 15:45:40 +01:00
function($resource) {
return $resource('persons/:id', {id: '@id'}, {
all: {
method: 'GET',
isArray:true,
transformResponse: function(data, headers) {
return angular.fromJson(data).persons;
}
}
});
}]
2015-03-21 13:21:15 +01:00
);