In Angular 8 in a component I am running the following line:
console.log(this.array);
In the browser, in developer mode I see the following result on the console:
So it clearly has some content. The following line writes '0' on the console:
console.log(this.array.length);
Here is the stackblitz code: https://stackblitz.com/edit/angular-ivy-g57vnv
In app component the array and array.length is logged on the console.
The content of the array is created as the following: in the service.service.ts, a GET request for authentication is fetched to a sample-backend hosted by Crowdvalley. As the cv-auth header is not the right one (on purpose), the response is an error. If the response does not contain the outcome 'success', to the array a string of 'false' is pushed (see ServiceService). If you look at the web app (https://angular-ivy-g57vnv.stackblitz.io) in developer mode, you see that the array has its fetched content, but it is still written that its length is 0.
Why is that? How can I investigate the true length? How can I access its content from the component?