SHARE
TWEET

Untitled

a guest Apr 18th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top