eventman/angular_app/js/services.js

33 lines
744 B
JavaScript
Raw Normal View History

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