return this.http.get(`${API}/${path}`).toPromise().then((snapshot) => { this.list = []; // prepare a list for intersection observer this._indexToObserve = 0; const items = snapshot.json(); this.list = items.reverse().map((item, index) => { /* provide 2 additional properties for each image: toLoad: boolean, the component to load image, index: number, the component to call observe(item) on image loaded */ item.toLoad = index < (this.indexToObserve + INTERSECT_PAGESIZE); item.index = index; return item; }); return this.list; });