From 78c2e7838a68bad262476b52cc5993ce8c12ad6b Mon Sep 17 00:00:00 2001 From: Marcelo Puebla Date: Fri, 24 Jan 2020 15:16:00 -0300 Subject: [PATCH] Add Timeout para cerrar modal en info-formas-pago --- .../info-formas-pago/info-formas-pago.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/modules/info-formas-pago/info-formas-pago.component.ts b/src/app/modules/info-formas-pago/info-formas-pago.component.ts index 69dc5d4..4d50067 100644 --- a/src/app/modules/info-formas-pago/info-formas-pago.component.ts +++ b/src/app/modules/info-formas-pago/info-formas-pago.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, TemplateRef } from '@angular/core'; +import { Component, OnInit, TemplateRef, OnDestroy } from '@angular/core'; import { BsModalService } from 'ngx-bootstrap/modal'; @Component({ @@ -6,17 +6,24 @@ import { BsModalService } from 'ngx-bootstrap/modal'; templateUrl: './info-formas-pago.component.html', styleUrls: ['./info-formas-pago.component.scss'] }) -export class InfoFormasPagoComponent implements OnInit { +export class InfoFormasPagoComponent implements OnInit, OnDestroy { mediaPantalla = false; + timer: any; constructor( private modalService: BsModalService, ) { } - ngOnInit() { + ngOnInit() { } + + ngOnDestroy() { + if (this.timer) clearTimeout(this.timer); } openGoCaja(templateRef: TemplateRef) { - this.modalService.show(templateRef, { class: 'modal-promo modal-sm modal-dialog-centered' }); + let modalRef = this.modalService.show(templateRef, { class: 'modal-promo modal-sm modal-dialog-centered' }); + this.timer = setTimeout(() => { + modalRef.hide(); + }, 3000); } } -- 1.9.1