I am inputting an array of objects into a component that are generated from an HTTP request response (asynchronous), and I want to fill up a different array with just the first three array elements.
I want to fill up the new array at the same time as the first array gets assigned from the parent input.
Here's my code that does not work:
private _images: any[];
private threeImages: any[];
@Input()
set images(images: any[]) {
this._images = images;
for(let i=0; i < 3; i++){
this.threeImages = images[i];
}
}
get images() { return this._images }
Why can't I intercept input property changes of an inputed array using a setter? And what is a good alternative way to achieve the outcome I want?