ngcordova angularjs 地理定位 google 地图(无离子)

ngcordova angularjs geolocation google maps (no ionic)

我想了解如何使用 ngcordova angularjs 但没有离子框架来显示带有一些自定义标记的 Google 地图。

你能给我指一个全面的初学者教程(没有遗漏的步骤)来解释如何做吗?

非常感谢

您有多种选择:

  • 您可以简单地使用 Angular 模块,例如 ngMap,在这种情况下,您不需要教程,而是他们的文档。在那里你可以找到各种例子。

  • 你可以采用像cordova-plugin-googlemaps这样的Cordova插件,文档中有具体的教程

  • 也在此处搜索,例如:angular-js-and-google-maps

它在应用程序和浏览器中工作。 1. 在index.html

中添加google地图脚本
 <script type="text/javascript" src="http://maps.google.com/maps/api/js">
</script>
  1. 在html侧

3 在脚本端

var latlng = {
lat: 12.34343,
lng: 34.12313
 };
var map;

 function initMap(latlng) {
   var map = new google.maps.Map(document.getElementById('map'), {
    center: latlng,
    scrollwheel: false,
    zoom: 14,
    dragging: false,
    scrollwheel: false,
    draggable: false,
    zoomControl: false,
    disableDoubleClickZoom: true,
    keyboardShortcuts: false,
    panControl: false,
    streetViewControl: false,
    disableDefaultUI: false
  });
   var cityCircle = new google.maps.Circle({
    strokeColor: '#F2F2F2',
    strokeOpacity: 0.7,
    strokeWeight: 2,
    fillColor: '#0DCCC0',
    fillOpacity: 0.7,
    map: map,
    center: latlng,
    radius: Math.sqrt(5) * 100
   });
 }

4。调用 initMap(latlng)

它在我的应用程序和浏览器中运行良好。并最大程度地利用其在标记上的设计。就像一个圆圈。