Angular-Google-地图 ui-gmap-标记不可见

Angular-Google-Maps ui-gmap-markers not visible

我正在使用 angular-google-maps 将标记数组基本加载到 google 地图中。我无法让我的指令正常工作。我没有收到任何错误,但标记没有出现。我的代码如下。

这种情况有什么好的调试方法吗?

HTML:

    <ui-gmap-google-map center='map.center' zoom='map.zoom' events='map.events'>
      <ui-gmap-search-box template="searchbox.template" events="searchbox.events" options="searchbox.options" position="searchbox.position"></ui-gmap-search-box>
      <ui-gmap-markers
        models='markers'
        coords='"self"'
        >
      </ui-gmap-markers>
      <ui-gmap-layer type='TransitLayer'></ui-gmap-layer>
    </ui-gmap-google-map>

JS:

$scope.markers = [{
    id: '5WnUJbhPEg',
    coords: { latitude: 42, longitude: -71 }
}];

$scope.$watch(function() {
        return $scope.markers;
    }, function(newValue, oldValue) {
        console.log('markers changed in $watch');
        console.log($scope.markers);
    }, 
    true
);

发现

  <ui-gmap-markers
    models='markers'
    coords='"self"'
    >
  </ui-gmap-markers>

应该是

  <ui-gmap-markers
    models='markers'
    coords='"coords"'
    >
  </ui-gmap-markers>

我认为 'self' 只有在

时才有效
$scope.markers = [{
    id: '5WnUJbhPEg',
    latitude: 42,
    longitude: -71
}];