Cannot read property ''" of null


This is one of the common issues I noticed in ionic 3

My current app requires me to fetch eventlist from third party web API. I always notice that ionic will throw this error (which happens when you did not define your variable property before hand, and trying to interpolate it in view).

What happens is when i run my app via ionic serve -l , the view will attempt to interpolate the eventlist array, but because it takes a while for the eventlist to fetch, it will always throw this error…but upon dismissing the error screen, some of the information has already been loaded.

Is there a way to ensure the information has been fully fetched before the html renders?


in which function do you call API to get eventlist?


http.get(“someUrl”).map(res=>json()).subscribe(data =>{

this.eventlist = data


On my html side, I am trying to show

Basically, before the data is fully loaded, ionic throw an runtime exception error. However after i dismiss the error, i found that the image/data has been loaded…


Angular’s async pipe.