can now switch championships
This commit is contained in:
parent
0f1434bb25
commit
19aa6f3a4c
@ -1,3 +1,3 @@
|
||||
<mat-list>
|
||||
<mat-list-item *ngFor="let championship of championships()"> {{championship.name}} </mat-list-item>
|
||||
<mat-list-item (click)="selectChampionship(championship)" *ngFor="let championship of championships()"> {{championship.name}} </mat-list-item>
|
||||
</mat-list>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {MatDialogRef} from '@angular/material';
|
||||
import {ChampionshipService} from '../championship.service';
|
||||
import {Router} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-championshipselectordialog',
|
||||
@ -10,7 +11,8 @@ import {ChampionshipService} from '../championship.service';
|
||||
export class ChampionshipselectordialogComponent implements OnInit {
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<ChampionshipselectordialogComponent>,
|
||||
private championshipService: ChampionshipService) { }
|
||||
private championshipService: ChampionshipService,
|
||||
private router: Router) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -20,4 +22,9 @@ export class ChampionshipselectordialogComponent implements OnInit {
|
||||
return this.championshipService.getChampionships();
|
||||
}
|
||||
|
||||
selectChampionship(championship: any) {
|
||||
this.championshipService.setChampionship(championship.idchampionship);
|
||||
this.router.navigate(['championship', championship.idchampionship]);
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user