Improves album directives

This commit is contained in:
2016-02-12 11:37:36 +01:00
parent df62e82922
commit ce1ee99c9f
5 changed files with 24 additions and 18 deletions

View File

@@ -1,9 +1,13 @@
var services = angular.module('satbd.satellite.bar.services',[])
services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
function cleanupFields(album) {
album.serie = album.série;
return album;
}
function get(id) {
return $http.get('/api/albums/'+ id).then(function (response) {
return response.data;
return cleanupFields(response.data);
});
}
@@ -12,7 +16,7 @@ services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
defer.reject('Search is not implemented');
return defer.promise;
}
return {
get: get,
search: search