Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { ActivatedRoute } from '@angular/router';
  3. import { Pokemon } from 'src/app/models/pokemon.model';
  4. import { PokemonService } from 'src/app/services/pokemon.service';
  5.  
  6. @Component({
  7. selector: 'app-pokemon-detail-view',
  8. templateUrl: './pokemon-detail-view.component.html',
  9. styleUrls: ['./pokemon-detail-view.component.css'],
  10. })
  11. export class PokemonDetailViewComponent implements OnInit {
  12. pokemonName: string;
  13. pokemon: Pokemon;
  14.  
  15. constructor(private pokemonService: PokemonService, private route: ActivatedRoute) {}
  16.  
  17. ngOnInit() {
  18. this.pokemonName = this.route.snapshot.paramMap.get('name');
  19. this.pokemonService.getPokemon(this.pokemonName).subscribe(pokemon => {
  20. this.pokemon = pokemon;
  21. });
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement