0

我正在使用 AngularJS 和 ng-map。

如何将路线原点设置为我当前的位置?

我试过了:

<directions 
    destination="..."
    origin="current-location">
</directions>
  

但这会导致地图不渲染任何东西。

感谢您帮助我将当前位置设置为原点。

卡尔

4

1 回答 1

1

它目前不受支持,但正在积压中。

Allen 提供了以下响应以使用 API 调用获取当前位置:

https://github.com/allenhwkim/angularjs-google-maps/blob/master/services/navigator_geolocation.js

NavigatorGeolocation.getCurrentPosition().then(function(pos) { ... });

于 2015-08-12T03:13:57.110 回答