From d8c76b0c35037a60f62eeed7f9dc25c29ee4f1c2 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 10 Apr 2019 13:29:11 +0200 Subject: [PATCH] MOBILE-2949 rating: Event that notifies rate component loading status --- src/core/rating/components/rate/rate.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/rating/components/rate/rate.ts b/src/core/rating/components/rate/rate.ts index 581de6e66..b2c897523 100644 --- a/src/core/rating/components/rate/rate.ts +++ b/src/core/rating/components/rate/rate.ts @@ -35,6 +35,7 @@ export class CoreRatingRateComponent implements OnChanges { @Input() aggregateMethod: number; @Input() scaleId: number; @Input() userId: number; + @Output() onLoading: EventEmitter; // Eevent that indicates whether the component is loading data. @Output() onUpdate: EventEmitter; // Event emitted when the rating is updated online. item: CoreRatingInfoItem; @@ -43,6 +44,7 @@ export class CoreRatingRateComponent implements OnChanges { constructor(private domUtils: CoreDomUtilsProvider, private translate: TranslateService, private ratingProvider: CoreRatingProvider, private ratingOffline: CoreRatingOfflineProvider) { + this.onLoading = new EventEmitter(); this.onUpdate = new EventEmitter(); } @@ -77,6 +79,7 @@ export class CoreRatingRateComponent implements OnChanges { }); } + this.onLoading.emit(true); this.ratingOffline.getRating(this.contextLevel, this.instanceId, this.ratingInfo.component, this.ratingInfo.ratingarea, this.itemId).then((rating) => { this.rating = rating.rating; @@ -86,6 +89,8 @@ export class CoreRatingRateComponent implements OnChanges { } else { this.rating = CoreRatingProvider.UNSET_RATING; } + }).finally(() => { + this.onLoading.emit(false); }); }