From 11b3f14c758e57f9cb5f32d8140fa043094bb3d7 Mon Sep 17 00:00:00 2001 From: Leo Mouyna Date: Tue, 14 May 2019 23:38:59 +0200 Subject: fix: Close modal after clicking on download Use the NgActiveModal method to close it on a click by adding a specific modalActive object and use it on download function. See issue: Chocobozzz#1436 --- client/src/app/shared/video/modals/video-download.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/video/modals/video-download.component.ts index d6d10d29e..a07560f87 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/video/modals/video-download.component.ts @@ -1,6 +1,6 @@ import { Component, ElementRef, ViewChild } from '@angular/core' import { VideoDetails } from '../../../shared/video/video-details.model' -import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' import { I18n } from '@ngx-translate/i18n-polyfill' import { Notifier } from '@app/core' @@ -16,6 +16,7 @@ export class VideoDownloadComponent { resolutionId: number | string = -1 video: VideoDetails + activeModal: NgbActiveModal constructor ( private notifier: Notifier, @@ -26,9 +27,7 @@ export class VideoDownloadComponent { show (video: VideoDetails) { this.video = video - const m = this.modalService.open(this.modal) - m.result.then(() => this.onClose()) - .catch(() => this.onClose()) + this.activeModal = this.modalService.open(this.modal) this.resolutionId = this.video.files[0].resolution.id } @@ -39,6 +38,7 @@ export class VideoDownloadComponent { download () { window.location.assign(this.getLink()) + this.activeModal.close() } getLink () { -- cgit v1.2.3