0
我正在使用Meteor dburles:maps
包,並試圖從Google Maps API實現geolocation
功能,但似乎無法找到如何解決此問題的方法。我有以下的JS和HTML結構:Meteor dburles:地圖包添加地理位置
的.html
<template name="map">
<div class="map-container">
{{> googleMap name="map" options=mapOptions}}
</div>
<div class="container">
<div class="search">
<input id="search" type="text">
</div>
</div>
</template>
的.js
Meteor.startup(function() {
GoogleMaps.load();
});
Template.map.helpers({
mapOptions: function() {
if (GoogleMaps.loaded()) {
return {
center: new google.maps.LatLng(-37.8136, 144.9631),
zoom: 8
};
}
}
});
Template.map.onCreated(function() {
GoogleMaps.ready('map', function(map) {
if(navigator.geolocation) {
// Support
} else {
// No support
}
})
})
我想我必須與Template.map.onCreated
內的API進行交互,但我似乎無法弄清楚究竟要添加什麼。我已經看過谷歌地圖文檔,但結構不同,因爲有些東西是軟件包在引擎蓋下。任何遇到過這個問題並解決了它的人?
你想解決什麼問題? – Yaniv
插入地理位置,以便地圖加載用戶的當前位置。 –