Closed nynhex closed 8 years ago
The problem here is you call markers = window.handler.addMarkers
before you define the handler
`
` I'm not and still getting the error.
@Hamdan85 your js is messed up. Few points: google doesnt create the map right away, this is why buildMap
takes a function as an argument. This function is executed whenever map is ready.
Then do not try to fit map to markers without markers created.
There is a plunk there showing it works properly: https://plnkr.co/edit/HagqQ6yt0QUDjCGhp6Ha?p=preview
I just upgraded to the latest version of gmapsforrails and have setup my views properly per the docs. I'm trying to render a bunch of units on a map but the map displays but the units do not and in the dev console I get:
handler.js?body=1:38 Uncaught TypeError: Cannot read property 'addMarker' of undefined
Here is my controller and view code
gps_controller.rb
gps/show.html.erb
In the head of application.html.erb
Not sure what the problem is here, I honestly don't have a thorough enough understanding of the API and this gem to debug myself without countless hours being spent. Has anyone ran across this and can you suggest a fix?