Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { CreateGame } from 'src/app/models/create-game';
import { Team } from 'src/app/models/team';
import { GameService } from 'src/app/services/game.service';
import { TeamService } from 'src/app/services/team.service';
@Component({
selector: 'app-create-game-form',
templateUrl: './create-game-form.component.html',
styleUrls: ['./create-game-form.component.css']
})
export class CreateGameFormComponent implements OnInit {
@Output() formSubmitEvent: EventEmitter<any> = new EventEmitter();
model: CreateGame = {gameDateTime: null, homeTeam: null, awayTeam: null};
teams: Team[] = [];
submitted = false;
confirmed = false;
test: string = "Test";
constructor(
private teamService: TeamService,
private gameService: GameService
) { }
ngOnInit(): void {
this.getTeams();
}
getTeams(): void {
this.teamService.getTeams()
.subscribe(teams => this.teams = teams);
}
onSubmit() : void {
this.submitted = true;
}