Commit 78c2e7838a68bad262476b52cc5993ce8c12ad6b
1 parent
2eadadf04a
Exists in
develop
Add
Timeout para cerrar modal en info-formas-pago
Showing
1 changed file
with
11 additions
and
4 deletions
Show diff stats
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 | import { BsModalService } from 'ngx-bootstrap/modal'; | 2 | import { BsModalService } from 'ngx-bootstrap/modal'; |
| 3 | 3 | ||
| 4 | @Component({ | 4 | @Component({ |
| 5 | selector: 'app-formas-pago', | 5 | selector: 'app-formas-pago', |
| 6 | templateUrl: './info-formas-pago.component.html', | 6 | templateUrl: './info-formas-pago.component.html', |
| 7 | styleUrls: ['./info-formas-pago.component.scss'] | 7 | styleUrls: ['./info-formas-pago.component.scss'] |
| 8 | }) | 8 | }) |
| 9 | export class InfoFormasPagoComponent implements OnInit { | 9 | export class InfoFormasPagoComponent implements OnInit, OnDestroy { |
| 10 | mediaPantalla = false; | 10 | mediaPantalla = false; |
| 11 | timer: any; | ||
| 11 | 12 | ||
| 12 | constructor( | 13 | constructor( |
| 13 | private modalService: BsModalService, | 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 | openGoCaja(templateRef: TemplateRef<any>) { | 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 | } |
| 23 | 30 |