【发布时间】:2021-04-04 11:49:54
【问题描述】:
在我的 game.component.ts 中,我尝试访问主游戏数组中的一个数组,但我无法使用 typescript 访问平台名称(array7)。
constructor(
private gamesService:GamesService,
private router: Router,
) {
this.game = new Game('', '', [], '', [], 1 );
console.log(this.game);
this.gamesService.getListGames(this.page).subscribe( (data: any) =>{
//console.log(data.results);
console.log(data);
this.gameslist = data.results;
//this.count = data.results.length;
console.log(this.count);
//this.nextpage = game.next;
console.log(this.nextpage);
console.log(data.results);
if(data.platforms == 'PC')
{
return this.pcIcon= '../assets/pc.png';
}
});
如何访问console.log(data.results " platform name"中的platforms.name ????
在console.log中打印一个对象游戏的平台名称,每个游戏都有不同的平台名称。
我正在 typescript 中查找平台名称,以便稍后获取每个平台的 .png 图像。
【问题讨论】:
-
为了帮助您,首先我需要知道向我们展示的屏幕截图是什么。那是“console.log(data)”吗?
标签: arrays angular typescript api