Newer
Older
import { Component, OnInit } from '@angular/core';
import { Game } from 'src/app/models/game';
import { Team } from 'src/app/models/team';
import { GameService } from 'src/app/services/game.service';
@Component({
selector: 'app-games',
templateUrl: './games.component.html',
styleUrls: ['./games.component.css']
})
export class GamesComponent implements OnInit {
games: Array<Game> = [];
constructor(private gameService: GameService) { }
ngOnInit(): void {
this.getGames();
}
getGames() {
this.gameService.getGames()
.subscribe(games => this.games = games);
}
}