dburles / meteor-google-maps

🗺 Meteor package for the Google Maps Javascript API v3
https://atmospherejs.com/dburles/google-maps
MIT License
196 stars 49 forks source link

Uncaught TypeError: Cannot read property 'appendChild' of null (google-maps.js: 12) #86

Closed fvpDev closed 8 years ago

fvpDev commented 9 years ago

Of all possible problems I am getting a "Uncaught TypeError: Cannot read property 'appendChild' of null" error for google-maps.js line 12 which is document.body.appendChild(script);

It's boggling my mind: I set it up to load within Router.onAfterAction() on the client...what could I be doing wrong, shouldn't document.body not return null at that point?

fvpDev commented 9 years ago

@jshimko, You ever encounter this problem? ^

dburles commented 9 years ago

Not sure exactly, I suggest trying onBeforeAction instead

fvpDev commented 9 years ago

Ok I will try that today/tomorrow

dburles commented 8 years ago

Hey @fvpDev interested to know if that solved the issue.

fvpDev commented 8 years ago

I called GoogleMaps.ready() in the onCreated hook of the map template without involving Router at all and I called GoogleMaps.load() in a Meteor.startup() call. I don't think I ever did manage to figure out what exactly the problem was but it turns out I didn't need to use Router. Works for me -> http://joesnewyorkpizzeria.com/

That way, I was able to have everything gMaps-related in one file.