Commit 78c2e7838a68bad262476b52cc5993ce8c12ad6b

Authored by Marcelo Puebla
1 parent 2eadadf04a
Exists in develop

Add

Timeout para cerrar modal en info-formas-pago
src/app/modules/info-formas-pago/info-formas-pago.component.ts
1   -import { Component, OnInit, TemplateRef } from '@angular/core';
  1 +import { Component, OnInit, TemplateRef, OnDestroy } from '@angular/core';
2 2 import { BsModalService } from 'ngx-bootstrap/modal';
3 3  
4 4 @Component({
... ... @@ -6,17 +6,24 @@ import { BsModalService } from 'ngx-bootstrap/modal';
6 6 templateUrl: './info-formas-pago.component.html',
7 7 styleUrls: ['./info-formas-pago.component.scss']
8 8 })
9   -export class InfoFormasPagoComponent implements OnInit {
  9 +export class InfoFormasPagoComponent implements OnInit, OnDestroy {
10 10 mediaPantalla = false;
  11 + timer: any;
11 12  
12 13 constructor(
13 14 private modalService: BsModalService,
14 15 ) { }
15 16  
16   - ngOnInit() {
  17 + ngOnInit() { }
  18 +
  19 + ngOnDestroy() {
  20 + if (this.timer) clearTimeout(this.timer);
17 21 }
18 22  
19 23 openGoCaja(templateRef: TemplateRef<any>) {
20   - this.modalService.show(templateRef, { class: 'modal-promo modal-sm modal-dialog-centered' });
  24 + let modalRef = this.modalService.show(templateRef, { class: 'modal-promo modal-sm modal-dialog-centered' });
  25 + this.timer = setTimeout(() => {
  26 + modalRef.hide();
  27 + }, 3000);
21 28 }
22 29 }