Commit c0480eee32de3f1541e8ebac11f8f0c0ec2989f7
1 parent
5138762fa2
Exists in
develop
and in
1 other branch
se para el timeout al apretar boton finalizar
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
src/app/modules/mensaje-final/mensaje-final.component.ts
| ... | ... | @@ -8,6 +8,7 @@ import { Router } from '@angular/router'; |
| 8 | 8 | styleUrls: ['./mensaje-final.component.scss'] |
| 9 | 9 | }) |
| 10 | 10 | export class MensajeFinalComponent implements OnInit { |
| 11 | + timer: any; | |
| 11 | 12 | |
| 12 | 13 | constructor( |
| 13 | 14 | public articuloService: ArticuloService, |
| ... | ... | @@ -15,11 +16,15 @@ export class MensajeFinalComponent implements OnInit { |
| 15 | 16 | ) { } |
| 16 | 17 | |
| 17 | 18 | ngOnInit() { |
| 18 | - setTimeout(() => { | |
| 19 | + this.timer = setTimeout(() => { | |
| 19 | 20 | this.goToSplash(); |
| 20 | 21 | }, 10000); |
| 21 | 22 | } |
| 22 | 23 | |
| 24 | + ngOnDestroy() { | |
| 25 | + clearTimeout(this.timer); | |
| 26 | + } | |
| 27 | + | |
| 23 | 28 | goToSplash() { |
| 24 | 29 | this.articuloService.cleanShoppingCar(); |
| 25 | 30 | this.router.navigate(['']); |