informacion.component.ts 1.2 KB
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
	selector: 'app-informacion',
	templateUrl: './informacion.component.html',
	styleUrls: ['./informacion.component.css']
})
export class InformacionComponent implements OnInit {

	private id2name = {
		"1": "el-equilibrista.jpg",
		"2": "fun-home.jpg",
		"3": "giragringa.jpg",
		"4": "forever-young.jpg"
	};

	public imagename;
	public imageid;

	public funciones : boolean = false;
	public entradas : boolean = false;
	public tiempo : boolean = false;
	public teatro : boolean = false;

	constructor(
		private route : ActivatedRoute,
		private router : Router,
	) {}

	ngOnInit(): void {
		this.route.paramMap.subscribe(
			(params) => {
				this.imageid = params.get('id');
				this.imagename = this.id2name[this.imageid]
			}
		);
	}

	showInfo(show : string) {
		console.log(show);
		this.funciones = this.teatro = this.tiempo = this.entradas = false;
		switch (show) {
			case "Funciones":
				this.funciones = true;
				break;
			case "Entradas":
				this.entradas = true;
				break;
			case "Tiempo":
				this.tiempo = true;
				break;
			case "Teatro":
				this.teatro = true;
				break;
		}
	}

}