我无法显示谷歌地图标记

时间:2016-12-05 22:59:30

标签: javascript angularjs angularjs-scope google-maps-markers

我无法在地图上显示谷歌地图标记。怎么了?这是一天:(我做错了吗?请帮助它真的很烦人,我是角的新手。我能够显示完整的地图,但不显示标记:(



A[0,:]

var appa = angular.module('appa',['firebase','uiGmapgoogle-maps']);

appa.controller('mainCtrl', function($firebaseObject,$scope) {
  const rootRef =  firebase.database().ref();
  this.object = $firebaseObject(rootRef);
$scope.markers = [];
var mark =
 {
            lat: 51.2019053,
            lng: 4.404418,
            message: "I want to travel here!",
            focus: true,
            draggable: false
};
var marker = new google.maps.Marker(mark);
$scope.markers.push(marker);
console.log(mark);
  $scope.map = {
    center:
    {
      latitude: 51.219053, longitude: 4.404418 },
     zoom: 14
              };

    });




1 个答案:

答案 0 :(得分:0)

完全不是这方面的专家,但...... 根据{{​​3}},你应该使用< ui-gmap-marker />而不是< marker />即使有像< marker />这样的东西看起来你有一个标记的开放标记,里面有另一个开放标记,但这次关闭。我指的是这部分:

var arr = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260'],
    res = arr.map((c,i,a) => [c.match(/\d/g)
                               .reduce((p,c) => +p + +c), c])
             .reduce((p,c) => c[0] >= p[0] ? c
                                           : p, [0])[1];
console.log(res);

这应该只是:

<marker>
<marker ng-repeat=" pos in markers" position="{{pos.lat}},{{pos.lng}}"></marker>

或根据文件:

<marker ng-repeat=" pos in markers" position="{{pos.lat}},{{pos.lng}}"></marker>