2

Thanks to @AJoslin I now have a working google map using only AngularUI and AngularJS.

Unfortunately there are two things I can't figure out how to do which may have to do with Google Map API and my lack of understanding of.

When the map initially loads, I already have a location so I wish to load it with a marker already on it. How do I do that?

I also wish to set the ng-click="myMap.panTo(marker.getPosition()) not to a new marker but to the initial location, which is the only marker I would have since I'm removing the add marker functionality out, once I can figure this one out.

Here is the working jsfiddle

http://jsfiddle.net/jorgecas99/xMw6U/

4

1 回答 1

3

我认为这应该可以通过设置 tilesloaded 事件来实现,但没有这样管理,所以我最终使用了一个简单的“技巧”,看着 myMap 出现。

  $scope.$watch('myMap', function(){
    $scope.setHome();
  });

  $scope.setHome = function() {
    $scope.homeMarker = new google.maps.Marker({
    map: $scope.myMap,
    position: $scope.mapOptions.center
  });
  }
于 2013-04-27T18:49:01.397 回答