Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Display array with ngFor

$
0
0

@Ditister wrote:

I have a async function that generats an array:

service:

async getSpieltermineList(){


   let anwesenheit = [] ;
   let spieltermin = [];


 this.anwesenheit  = this.afs.collection('anwesenheit')
   await this.anwesenheit.ref.where('email','==','te@te.de').get().then((results) => {
     results.forEach((doc) => {
       anwesenheit[doc.data().spielterminName] = doc.data();
     });

     this.spieltermin = this.afs.collection('spieltermin')
      this.spieltermin.ref.orderBy('adresse', 'desc').limit(3).get().then((docSnaps) => {
             docSnaps.forEach((doc) => {
                spieltermin[doc.id] = doc.data();
                spieltermin[doc.id].status = anwesenheit[doc.data().name].status;
     });
    });
   })
      return spieltermin;
  }

I call the function like this:

 spieltermin = [];

this.ss.getSpieltermineList().then(spieltermin =>{
this.spieltermin = spieltermin;

 console.log(this.spieltermin)

 })


console.log gives me back this array:

But when i am trying to display the array in a list nothing happens.

<ion-list>

        <ion-item *ngFor="let s of spieltermin" (click)="selectSpieltermin(s.musikgruppe,s)" >

          <h2> {{s.name}}</h2>

        </ion-item>
      </ion-list>

What i am doing wrong?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>