Ravi Ji
Ravi Ji

Reputation: 126

How to close infowindow when clicking outside/map?

How to close infowindow when clicking map or outside of the map...

Ex: google.maps.event.addListener(map, "click", function(event) { infowindow.close(); });

how to implement this code in ng-map?

Upvotes: 1

Views: 1038

Answers (1)

Ravi Ji
Ravi Ji

Reputation: 126

Finally found the solution my self for this..

$scope.$on("mapInitialized", function(evt, evtMap) {
    $scope.map = evtMap;           

    google.maps.event.addListener($scope.map, 'click', function(event) {
        $scope.map.hideInfoWindow('myInfoWindow', this);
    });
});

Upvotes: 2

Related Questions