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); } }