Last active
May 20, 2022 15:29
-
-
Save NyaGarcia/643312e34a9de8cba4b7510b02558a28 to your computer and use it in GitHub Desktop.
Pokemon list component
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, EventEmitter, Input, OnInit, Output } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { Pokemon } from '../../interfaces/pokemon.interface'; | |
@Component({ | |
selector: 'app-list', | |
templateUrl: './list.component.html', | |
styleUrls: ['./list.component.scss'], | |
}) | |
export class ListComponent implements OnInit { | |
@Input() pokemon$: Observable<Pokemon[]>; | |
@Output() pokemonEmitter = new EventEmitter<Pokemon>(); | |
constructor() {} | |
ngOnInit(): void {} | |
selectPokemon(pokemon: Pokemon) { | |
this.pokemonEmitter.emit(pokemon); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment