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
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
4 | 4 | ||
5 | @Component({ | 5 | @Component({ |
6 | selector: 'app-mensaje-final', | 6 | selector: 'app-mensaje-final', |
7 | templateUrl: './mensaje-final.component.html', | 7 | templateUrl: './mensaje-final.component.html', |
8 | styleUrls: ['./mensaje-final.component.scss'] | 8 | styleUrls: ['./mensaje-final.component.scss'] |
9 | }) | 9 | }) |
10 | export class MensajeFinalComponent implements OnInit { | 10 | export class MensajeFinalComponent implements OnInit { |
11 | timer: any; | ||
11 | 12 | ||
12 | constructor( | 13 | constructor( |
13 | public articuloService: ArticuloService, | 14 | public articuloService: ArticuloService, |
14 | private router: Router, | 15 | private router: Router, |
15 | ) { } | 16 | ) { } |
16 | 17 | ||
17 | ngOnInit() { | 18 | ngOnInit() { |
18 | setTimeout(() => { | 19 | this.timer = setTimeout(() => { |
19 | this.goToSplash(); | 20 | this.goToSplash(); |
20 | }, 10000); | 21 | }, 10000); |
21 | } | 22 | } |
22 | 23 | ||
24 | ngOnDestroy() { | ||
25 | clearTimeout(this.timer); | ||
26 | } | ||
27 | |||
23 | goToSplash() { | 28 | goToSplash() { |
24 | this.articuloService.cleanShoppingCar(); | 29 | this.articuloService.cleanShoppingCar(); |
25 | this.router.navigate(['']); | 30 | this.router.navigate(['']); |
26 | } | 31 | } |
27 | 32 | ||
28 | } | 33 | } |
29 | 34 |