javascript - Pass coordinates of current Google Maps marker -
maybe simple question couldn't find easy answer it. have eventhandler on marker makes infowindow pop ng-click inside of it:
google.maps.event.addlistener(mymarker, 'click', function() { var contentstring = "<div>somerandomstring<br/>" + "<a ng-click='send()'>send google maps</a></div>"; var compiled = $compile(contentstring)($scope); infowindow.setcontent(compiled[0]); infowindow.open($scope.map, mymarker); }); is there way can pass coordinates of mymarker function send()? send(this.position) ?
you should able following using mymarker.getposition()
google.maps.event.addlistener(mymarker, 'click', function() { var location = mymarker.getposition().tostring(); var contentstring = "<div>somerandomstring<br/>" + "<a ng-click='send(" + location + ")'>send google maps</a></div>"; var compiled = $compile(contentstring)($scope); infowindow.setcontent(compiled[0]); infowindow.open($scope.map, mymarker); });
Comments
Post a Comment