Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2. import { Pokemon } from './pokemon';
  3. import { POKEMONS } from './mock-pokemons';
  4. import { Router } from '@angular/router';
  5.  
  6. @Component({
  7. selector: 'list-pokemon',
  8. templateUrl: './app/list-pokemon.component.html'
  9. })
  10. export class ListPokemonComponent {
  11. private Pokemon[]: null;
  12.  
  13. constructor(private router: Router){ }
  14.  
  15. ngOnInit(){
  16. this.pokemons = POKEMONS;
  17. }
  18.  
  19. selectPokemon(pokemon: Pokemon){
  20. let link = ['/pokemon', pokemon.id];
  21. this.router.navigate(link);
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement