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/

1 Answer 1

3

i think it should be achievable by setting the tilesloaded event, but didnt manage that way, so i ended up using a simple "trick", watching for myMap to appear.

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

  $scope.setHome = function() {
    $scope.homeMarker = new google.maps.Marker({
    map: $scope.myMap,
    position: $scope.mapOptions.center
  });
  }
Sign up to request clarification or add additional context in comments.

2 Comments

The map itself is passed to the callback if you specify it as a parameter.
right, in my case i just used a function that's there anyway, but proper example should use that :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.