Last active
July 10, 2023 11:53
-
-
Save NyaGarcia/f301f6c5621388d9fdf33dbc7cd77ef1 to your computer and use it in GitHub Desktop.
NgBytes Standalone Pokemon List
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 { Pokemon, PokemonService } from '../pokemon.service'; | |
import { CommonModule } from '@angular/common'; | |
import { PokemonCardComponent } from '../pokemon-card/pokemon-card.component'; | |
import { Router } from '@angular/router'; | |
@Component({ | |
selector: 'ngbytes-pokemon-list', | |
standalone: true, | |
imports: [CommonModule, PokemonCardComponent], | |
templateUrl: './pokemon-list.component.html', | |
styleUrls: ['./pokemon-list.component.css'], | |
}) | |
export class PokemonListComponent implements OnInit { | |
pokemonList: Pokemon[]; | |
constructor( | |
private readonly pokemonService: PokemonService, | |
private readonly router: Router | |
) { | |
this.pokemonList = this.pokemonService.getAll(); | |
} | |
openDetailsPage(id: string) { | |
this.router.navigate(['details/', id]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment