I am creating Ionic app with database on Firebase,so I have something like this in Firebase, and I am using angularfire2
to get the data
and I have no problem on getting paises
but I have tried getting the list of jugadores
but I get nothing.
This is my .ts
export class HomePage {
paises: Observable<any[]>
constructor(public navCtrl: NavController, db: AngularFireDatabase) {
this.paises = db.list('paises').valueChanges();
}
}
and this is my .html
<ion-content *ngFor="let pais of paises | async">
<ion-item-group>
<ion-item-divider color="light">{{pais.nombre}}</ion-item-divider>
<ion-item>{{pais.jugadores.Nombre}}</ion-item>
</ion-item-group>
I do get the pais.nombre
but when i try to get pais.jugadores
all i get is blank space. So if anybody could help me giving me info on how to get this tipe of information, because I have search online and nothing.
I presume your data structure like this.
"paises" is collection which is iterable using *ngFor.
pais.jugadores is object which is not iterable.
We want to change above object to collection like this.
use "Pipe" to change object array to collection
your component will be like
stackblitz example is here .