22 lines
543 B
TypeScript
22 lines
543 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { POKEMONS } from './mock-pokemon-list';
|
|
import { Pokemon } from './pokemon';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
templateUrl: 'app.component.html',
|
|
})
|
|
export class AppComponent implements OnInit {
|
|
pokemonList: Pokemon[] = POKEMONS;
|
|
pokemonSelected: Pokemon | undefined;
|
|
|
|
ngOnInit() {
|
|
console.table(this.pokemonList);
|
|
}
|
|
|
|
selectPokemon(pokemon: Pokemon) {
|
|
console.log(`Vous avez cliqué sur le pokémon ${pokemon.name}`);
|
|
this.pokemonSelected = pokemon;
|
|
}
|
|
}
|