I'm using a cache to store data fetched from an API, then using that data to make a chart in a div
on my Angular app.
I think the cache returns the data faster than the DOM loads, because when I print console.log(document.getElementByID(div_name)
, it prints null
. The same line prints the right element when the data is fetched from the back-end.
Is there anyway I can make my function wait till the DOM is loaded to query the cache?