Everyone hello,
I am facing a problem that I can not find a solution for about 3 days.
To summarize my problem, I have an Array with 10 capacities, and I want to update it with a function and add another 10, so I want to push the other array to an array.
The function I wrote about this is as follows;
posts: Array<Post> = new Array<Post>();
this posts have 10 posts before because getorderbydateposts worked one time when page opened.
Function
doInfinite(infiniteScroll) {
let page = (Math.ceil(this.posts.length/10)) + 1;
this.wordpressService.getOrderByDatePosts(page)
.subscribe(
(posts:Array<Post>) => {
console.log("Before push");
console.log(this.posts);
console.log("More new array");
console.log(posts);
for(var post of posts)
{
this.posts.push(post);
}
console.log("After push");
console.log(this.posts);
infiniteScroll.complete();
} ,
(error) =>console.error(error)
);
}
Here is the response I got from this code. It looks like the size of the Array is fixed and does not change. What is the reason of this ? Does anyone have such an error?