我正在使用ng-map,我正在使用navigator.geolocation.getCurrentPosition来获取用户的当前位置,但是在Ffx中,似乎没有调用成功回调。当我在回调函数中添加一个断点时,它永远不会被命中(它在我测试的其他浏览器中有效)。这是我的代码:
var options = {
};
navigator.geolocation.getCurrentPosition(
function (pos) {
var myLatLng = new google.maps.LatLng(parseFloat(pos.coords.latitude), parseFloat(pos.coords.longitude));
map.setCenter(myLatLng);
},
function (error) { return false; },
options);
我尝试了什么:
非常欢迎任何我能尝试的新想法或建议!
答案 0 :(得分:0)
我发现了那个设置:
position="current-location"
<{1>}上我用来显示当前位置的<custom-marker>
实际 调用navigator.geolocation.getCurrentPosition
并且干扰了我自己对{的调用{1}}。我现在使用以下作为getCurrentPosition
中的位置:
<custom-marker>
......我这样设置:
position="{{mapsCtrl.userLat + ',' + mapsCtrl.userLng}}"