fix iterating in games bar
This commit is contained in:
parent
26b5056bcd
commit
d0313ad119
@ -1,4 +1,4 @@
|
|||||||
<div class="games">
|
<div class="games">
|
||||||
<app-game-item [active]="i === activeGame" *ngFor="let game of games; index as i" [game]="game" (click)="activeGame = i"></app-game-item>
|
<app-game-item [active]="game.gameId === activeGame?.gameId" *ngFor="let game of games; index as i" [game]="game" (click)="activeGame = game"></app-game-item>
|
||||||
</div>
|
</div>
|
||||||
<app-game-info *ngIf="activeGame !== null" [game]="games[activeGame]"></app-game-info>
|
<app-game-info *ngIf="activeGame !== null" [game]="activeGame"></app-game-info>
|
||||||
|
@ -9,7 +9,7 @@ import { GetGames } from 'src/app/services/go';
|
|||||||
})
|
})
|
||||||
export class GamesBarComponent implements OnInit {
|
export class GamesBarComponent implements OnInit {
|
||||||
games: Game[] = [];
|
games: Game[] = [];
|
||||||
activeGame: Game['id'] | null = null;
|
activeGame: Game | null = null;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ export class GamesBarComponent implements OnInit {
|
|||||||
console.log(value);
|
console.log(value);
|
||||||
this.games = value;
|
this.games = value;
|
||||||
if (this.games.length > 0){
|
if (this.games.length > 0){
|
||||||
this.activeGame = this.games[0].title
|
this.activeGame = this.games[0]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user