eventman/angular_app/js/services.js

38 lines
954 B
JavaScript
Raw Normal View History

2015-03-22 08:57:57 +01:00
'use strict';
2015-03-22 09:19:30 +01:00
/* Services. */
2015-03-21 13:21:15 +01:00
var eventManServices = angular.module('eventManServices', ['ngResource']);
2015-03-22 09:19:30 +01:00
2015-03-21 13:21:15 +01:00
eventManServices.factory('Event', ['$resource',
2015-03-21 15:45:40 +01:00
function($resource) {
2015-03-21 20:31:36 +01:00
return $resource('events/:id', {id: '@_id'}, {
2015-03-21 15:45:40 +01:00
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) {
2015-03-21 20:31:36 +01:00
return $resource('persons/:id', {id: '@_id'}, {
2015-03-21 15:45:40 +01:00
all: {
method: 'GET',
2015-03-21 20:31:36 +01:00
isArray: true,
2015-03-21 15:45:40 +01:00
transformResponse: function(data, headers) {
return angular.fromJson(data).persons;
}
2015-03-21 16:48:00 +01:00
},
update: {method: 'PUT'}
2015-03-21 15:45:40 +01:00
});
}]
2015-03-21 13:21:15 +01:00
);