dburles / meteor-google-maps

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

Map container is empty #118

Closed proft closed 8 years ago

proft commented 8 years ago

Hello!

I started clean project. Added packages

twbs:bootstrap
coffeescript
dburles:google-maps

My template

<body>
  {{> markers}}
</body>

<template name="markers">
    <div class="map-container">
        {{> googleMap name="map" options=mapOptions}}
    </div>
</template>

My view

Template.markers.onCreated ->
    GoogleMaps.load({ v: '3', key: '123', libraries: 'geometry,places' });

Template.markers.onRendered ->
    GoogleMaps.ready("map", (obj) ->
        console.log 222
        map = obj.instance
        marker = new google.maps.Marker({
            position: obj.options.center,
            map: map
        });
    )

Template.markers.helpers ->
    mapOptions: ->
        if GoogleMaps.loaded()
            console.log 'rrr'
            return {
                center: new google.maps.LatLng(49.2348249, 28.399594),
                zoom: 10
            }

My styles

.map-container {
    width: 800px;
    height: 500px;
    border: 1px solid red;
}

... and my canvas is empty, only red border ... also console output is empty ... strange

proft commented 8 years ago

Rewrite with simple js - works ... with coffeescript ... doesn't :(

proft commented 8 years ago

My fall :) should be Template.markers.helpers, without ->

dburles commented 8 years ago

You could also use ES2015 instead! :)

proft commented 8 years ago

yup, already reading http://exploringjs.com/es6/ :)