From 3e14fbab2c531e8181366d969a66b7633a1da403 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Fri, 4 Mar 2016 09:33:19 +0100 Subject: [PATCH] Add $plain property to Restangular results --- frontend/app/components/api/api-v3/api-v3.config.ts | 2 ++ frontend/app/components/api/api-v3/hal/hal-resource.service.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/app/components/api/api-v3/api-v3.config.ts b/frontend/app/components/api/api-v3/api-v3.config.ts index 7484e188c2..64dba8d094 100644 --- a/frontend/app/components/api/api-v3/api-v3.config.ts +++ b/frontend/app/components/api/api-v3/api-v3.config.ts @@ -28,6 +28,8 @@ function apiV3Config(apiV3, halTransform) { apiV3.addResponseInterceptor((data, operation, what) => { + data.$plain = angular.copy(data); + apiV3.addElementTransformer(what, halTransform); if (data && data._type === 'Collection') { diff --git a/frontend/app/components/api/api-v3/hal/hal-resource.service.ts b/frontend/app/components/api/api-v3/hal/hal-resource.service.ts index 1b09d866b9..813aa8606a 100644 --- a/frontend/app/components/api/api-v3/hal/hal-resource.service.ts +++ b/frontend/app/components/api/api-v3/hal/hal-resource.service.ts @@ -47,7 +47,7 @@ function halResource(halTransform, HalLink, $q) { } constructor(protected $source, public $loaded = true) { - var source = $source.restangularized ? $source.plain() : angular.copy($source); + var source = angular.copy($source.restangularized ? $source.$plain : $source); this.$links = this.transformLinks(); this.$embedded = this.transformEmbedded();