0
I have a service me returning an array containing photos and when I "scroll" page it adds +1 on the photo page and I wanted to show the new photos below the current photos
getPhotos(page: number) {
this.updateMasonryLayout = true;
this.unsplashAPI.random(0 + page)
.subscribe(
(photos: any[]) => this.photos = photos,
(error: any) => this.errorMessage = error as any
);
}
This code returns me the page but always changes the current page or exchange the values of the array and I want to keep the old values plus new values
i would have to create an array to receive the old one first? pq I wanted to keep adding the return in the current array as one +=
– Giovanni Dias
you can do arrAtual= [...arrAtual, ...arrNovo]
– Eduardo Vargas
so it gets this.photos =[...this.photos, ...photos]?
– Giovanni Dias