informacion.component.ts
661 Bytes
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;
constructor(
private route : ActivatedRoute,
private router : Router,
) {}
ngOnInit(): void {
this.route.paramMap.subscribe(
(params) => this.imagename = this.id2name[params.get('id')]
);
}
}