Copy List array object to another array in Angular 9

Viewed 268

I am working with list array in angular. I have a problem in converting a array of list to another array for iteration purpose. below given the sample code.

fimage() {
    this.http.get < any > ('<-Apiurl->', { headers: this.header })
        .pipe(map(rese => {
            return { rese }
        }))
        .subscribe((result: any) => {
            this.fimg.push(result);
            this.simg = this.fimg[0].rese.images;
            // console.log(this.fimg);
            this.imgaecount();
        });
}
imgaecount() {
    var loob: any;
    var sec: any;
    for (let i = 0; i < this.simg.length; i++) {
        this.http.get < any > ('<-Apiurl->/' + this.simg[i].id, { headers: this.header })
            .pipe(map(res => {
                return { res }
            }))
            .subscribe((result2: any) => {
                loob = result2.res.image;
                this.ffimg.push(loob);
            });
    }
    console.log(this.ffimg);
}

I need to pass the image id to the second api call to get the image details. I got the response as expected but when i pushed the data to an array its showing not like an array. I can't able to iterate the array for the future purpose. below given the sample array structure .

enter image description here

I really appreciate any help :)

0 Answers
Related