mensaje-final.component.ts 825 Bytes
import { Component, OnInit } from '@angular/core';
import { ArticuloService } from 'src/app/services/articulo/articulo.service';
import { Router } from '@angular/router';

@Component({
  selector: 'app-mensaje-final',
  templateUrl: './mensaje-final.component.html',
  styleUrls: ['./mensaje-final.component.scss']
})
export class MensajeFinalComponent implements OnInit {
  timer: any;

  constructor(
    public articuloService: ArticuloService,
    private router: Router,
  ) { }

  ngOnInit() {
    this.timer = setTimeout(() => {
      this.goToSplash();
    }, 10000);
    $(document).ready(function() {
      $('body').removeClass('media-pantalla');
    });
  }

  ngOnDestroy() {
    clearTimeout(this.timer);
  }

  goToSplash() {
    this.articuloService.cleanShoppingCar();
    this.router.navigate(['']);
  }

}