Can't use attributes in tab view if is not an object


#1

Hi, my first problem was I couldnt pass parameters from TabsPage to ChildTabPage so I just send the id

<ion-tabs [selectedIndex]="mySelectedIndex" dark>
  <ion-tab [root]="tab1Root" [rootParams]="game" tabTitle="Players"></ion-tab>
  <ion-tab [root]="tab2Root" [rootParams]="game" tabTitle="Events"></ion-tab>
</ion-tabs>

Where game is an object sent from another Page. This doesnt work so I just pass the ID

<ion-tabs [selectedIndex]="mySelectedIndex" dark>
    <ion-tab [root]="tab1Root" [rootParams]="gameId" tabTitle="Players"></ion-tab>
    <ion-tab [root]="tab2Root" [rootParams]="gameId" tabTitle="Events"></ion-tab>
</ion-tabs>

Now in my PlayersPage that is a ChildTabPage I can use

`this.gameId = navParams.data;`

Now I consume some RestService and I get two arrays and one object

JSON
{localPlayers :[{id,name},{id,name}...etc],guestPlayers:[{id,name},{id,name}],game:{id,localTeam,guestTeam}}

JS

this.game = null;

this.http.get(ruta).map(res => res.json()).subscribe(data => {
   this.localPlayers = data.localPlayers;
   this.guestPlayers = data.guestPlayers;
   this.game = data.game;
});

If I print with console.log(game) I see the data but I can’t use it in the view and I don’t know why, I just use the localPlayers and the guestPlayers

If instead of “this.game = null” I use “this.game = []” it works. This shouldn’t be like this right?

Please some help

Thanks