Last active
July 28, 2021 20:50
-
-
Save siuling88/f4776d365ff0e977771764fbc35699cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { ActivatedRoute } from '@angular/router'; | |
import { GenteService } from '../../services/gente.service'; | |
@Component({ | |
selector: 'formacion-detalle', | |
templateUrl: 'detalle.component.html', | |
}) | |
export class DetalleComponent implements OnInit { | |
persona: any = {}; | |
constructor( | |
private _genteService: GenteService, | |
private route: ActivatedRoute | |
) {} | |
ngOnInit() { | |
const routeParams = this.route.snapshot.paramMap; | |
const productIdFromRoute = Number(routeParams.get('id')); | |
this._genteService.getPersonas().subscribe((data) => { | |
this.persona = data.gente[productIdFromRoute]; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment