From 66973437e2e661904aadaec08e28cf9d5cbf5234 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Wed, 23 Mar 2016 14:34:21 +0100 Subject: [PATCH] Replace _$loadingPromise with $self and make it public --- .../api/api-v3/hal-resources/hal-resource.service.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/app/components/api/api-v3/hal-resources/hal-resource.service.ts b/frontend/app/components/api/api-v3/hal-resources/hal-resource.service.ts index 070e4b23fc..12a04aa2ee 100644 --- a/frontend/app/components/api/api-v3/hal-resources/hal-resource.service.ts +++ b/frontend/app/components/api/api-v3/hal-resources/hal-resource.service.ts @@ -33,11 +33,11 @@ function halResource($q, _, lazy, halTransform, HalLink) { } public $isHal:boolean = true; + public $self: ng.IPromise; private _name:string; private _$links:any; private _$embedded:any; - private _loadingPromise: ng.IPromise; public get name():string { return this._name || this.$links.self.$link.title || ''; @@ -85,20 +85,21 @@ function halResource($q, _, lazy, halTransform, HalLink) { return $q.when(this); } - if (!this.$loaded && this._loadingPromise) { - return this._loadingPromise; + if (!this.$loaded && this.$self) { + return this.$self; } - this._loadingPromise = this.$links.self().then(resource => { + this.$self = this.$links.self().then(resource => { this.$loaded = true; angular.extend(this, resource); return this; }); - return this._loadingPromise; + return this.$self; } + public $plain() { return angular.copy(this.$source); }