Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Last active May 20, 2022 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/643312e34a9de8cba4b7510b02558a28 to your computer and use it in GitHub Desktop.
Save NyaGarcia/643312e34a9de8cba4b7510b02558a28 to your computer and use it in GitHub Desktop.
Pokemon list component
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