can now switch between tiers

This commit is contained in:
Joachim 2018-09-01 17:02:04 +02:00
parent bce762bf4e
commit eb7ab4efd9

View File

@ -1,4 +1,4 @@
import {Component, Input, OnInit} from '@angular/core';
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import {ChampionshipService} from '../../championship.service';
@Component({
@ -6,7 +6,7 @@ import {ChampionshipService} from '../../championship.service';
templateUrl: './poule.component.html',
styleUrls: ['./poule.component.scss']
})
export class PouleComponent implements OnInit {
export class PouleComponent implements OnInit, OnChanges {
@Input()
poule: number;
@ -26,6 +26,10 @@ export class PouleComponent implements OnInit {
}
ngOnInit() {
this.loadData();
}
private loadData() {
console.log('POULE COMP: ' + this.poule + ' ' + this.idChampionship + ' ' + this.tier);
// fetch the poule data
this.championshipService.getTeamsInPoule(this.idChampionship, this.tier, this.poule).subscribe(val => {
@ -131,4 +135,10 @@ export class PouleComponent implements OnInit {
return this.timesIndexed[idTeam][raceNr].laptimesms;
}
ngOnChanges(changes: SimpleChanges): void {
console.log('onchanges called...');
console.log(changes);
this.loadData();
}
}