Don't transform non-resource elements

pull/4159/head
Alex Dik 9 years ago
parent 3ca833c7fe
commit a52e0e87e4
  1. 15
      frontend/app/components/api/api-v3/hal-transformed-element.service.ts

@ -108,22 +108,21 @@ function halTransformedElementService(Restangular:restangular.IService) {
}
/**
* Transform embedded properties to actual HAL resources.
* Transform embedded properties and their children to actual HAL resources,
* if they have links or embedded resources.
*/
//TODO: make restangularizeElement work correctly
protected transformEmbedded() {
return this.transformHalProperty('_embedded', (all, embedded, name) => {
angular.forEach(embedded, element => {
if (element && (element._links || element._embedded)) {
this.restangularize(element);
}
});
angular.forEach(embedded, element => element && this.restangularize(element));
all[name] = this.restangularize(embedded);
})
}
protected restangularize(element) {
if (!(element._links || element._embedded)) {
return element;
}
return new HalTransformedElement(Restangular.restangularizeElement(null, element, ''));
}

Loading…
Cancel
Save