javascript - Show window on Marker's click in Angular Google Maps -
i using http://angular-google-maps.org/api in order work google map. far able show markers somehow can't show windows on click.
<markers models="markers" coords="'last_known_location'" icon="'icon'" click="'onclicked'"> <windows show="'showwindow'" closeclick="'closeclick'" ng-cloak> <p ng-non-bindable style="width:200px">{angular{ options.title }angular}</p> <p ng-non-bindable>{angular{ latitude | number:4 }angular}, {angular{ longitude | number:4 }angular}!</p> </windows> </markers> as can see, uses showwindow property show window
i add together each marker doing
angular.foreach($scope.markers,function(marker){ marker.closeclick = function() { marker.showwindow = false; $scope.$apply(); }; marker.onclicked = function(){ alert(marker.id); onmarkerclicked(marker.id); }; }); the alert shows on click, ,
var onmarkerclicked = function(marker){ marker.showwindow = true; $scope.$apply(); } the property changed, window doesn't show up.
any ideas? thanks
your code works fine here...
the problem you're passing marker.id onmarkerclicked, not marker itself...
also, didn't need $scope.$apply() create work...
now i'm trying figure out how access model obj within windows tag...
javascript angularjs google-maps
No comments:
Post a Comment