Angular typeScript nested Array is not iterable?

Discussão em 'Angular' iniciado por Priyashan Jayasankha, Dezembro 15, 2024.

  1. I have a model class "EventDeatails" like this

    export class EventDetails {
    id: string;
    title: string;
    club: string;
    des: string;
    img: string;
    date: string;
    status: number;
    }


    then I assign values to this from firebase like this

    showingEventList: EventDetails[];

    this.eventDetails.getOldEvents().subscribe(actionArray => {
    this.showingEventList = actionArray.map(item => {
    return {
    id: item.payload.doc.id,
    ...item.payload.doc.data()
    } as EventDetails ;
    });
    });


    now I need to add only the club property of this object to another array called clubs[] I did it like this

    for ( const item of this.showingEventList ) {
    this.clubs.push(item.club);
    }


    but console shows there is an error:- " showingEventList is not iterable " how can I fix this ????

    Continue reading...

Compartilhe esta Página