【发布时间】:2014-08-16 04:27:27
【问题描述】:
我想用 ionic 构建移动应用程序,首先对用户进行地理定位,我想每 2 秒更新一次他的位置,这是地理定位的代码
$scope.makeFit = function() {
leafletData.getMap().then(function(map) {
map.locate({setView: true, maxZoom: 16});
var marker;
function onLocationFound(e) {
marker= new L.Marker(e.latlng);
marker.addTo(map)
.bindPopup("" + e.latlng + " ");
}
map.on('locationfound', onLocationFound);
});
};
【问题讨论】:
-
请说明你想问什么。
-
我的地图上有一个标记代表当前位置,我试图让它每 2 秒移动一次以跟随用户的位置