Flakerim Flakerim - 1 month ago 41
TypeScript Question

ionViewDidLoad error: Cannot read property 'firstChild' of null

In Ionic 2 App (Angular2 with Typescript), I am trying to pass a json to map for markers.

https://gist.github.com/flakerimi/9984172a911fd1bde7464e67686bd34d

But I am gettin this error, I don't even know how to trace it since Angular2.

view-controller.js:231 MapPage ionViewDidLoad error: Cannot read property 'firstChild' of null


What is firstChild in this case.

Answer

I wrapped code in setTimeOut then it works.

setTimeout(() =>{
      let mapEle = document.getElementById('map');
});
Comments