I am having an issue with my http requests where I only receive the data from the first request and not all of them. Can anyone help me with this problem?
Thank you in advance for your assistance.
Here is my function:
async asyncCall() {
return await this.subscription.push(forkJoin([this.http.get("https://pixabay.com/api/?key=15006679-5b02255bc032741ef0&q=phone wallpaper&per_page=200&min_height=200"),
this.http.get("https://pixabay.com/api/?key=15006679-5b02255bc032741ef0&q=dog&per_page=200&min_height=200`"),
this.http.get("https://pixabay.com/api/?key=15006679-5b02255bc032741ef0&q=cat&per_page=200&min_height=200`")
])
.subscribe((data: any) => {
// console.log("dtdtdt", data.map(e => console.log("e", e)))
// console.log(data.length)
for (let i = 0; i < data.length; i++) {
return this.images = data[i].hits;
}
}))
}
This is how I'm displaying the images in my HTML:
<div [ngSwitch]="galleryType">
<div class="images" *ngSwitchCase="'pinterest'">
<div class="one-image" *ngFor="let image of images, let i = index" tappable (click)="presentModal(i)">
<img src={{image.webformatURL}}>
</div>
</div>
</div>