angularjs - Adding location to Google Map on page load with Angular UI -
thanks @ajoslin have working google map using angularui , angularjs.
unfortunately there 2 things can't figure out how may have google map api , lack of understanding of.
when map loads, have location wish load marker on it. how do that?
i wish set ng-click="mymap.panto(marker.getposition())
not new marker initial location, marker have since i'm removing add marker functionality out, once can figure 1 out.
here working jsfiddle
i think should achievable setting tilesloaded event, didnt manage way, ended using simple "trick", watching mymap appear.
$scope.$watch('mymap', function(){ $scope.sethome(); }); $scope.sethome = function() { $scope.homemarker = new google.maps.marker({ map: $scope.mymap, position: $scope.mapoptions.center }); }
Comments
Post a Comment