Using angular-google-maps cannot bind click event with markers to display one window
I am getting JSON object as data source for my markers. After that, I bind the Click / Close functions for each marker
Plunk: http://plnkr.co/edit/A9IbIFpj3d9tH6z9NYjf?p=preview
angular.forEach(tmp, function(value, key){
value.onClick = function(){
console.log("Clicked!");
$scope.selected.show = false;
$scope.selected = value;
$scope.selected.show = !$scope.selected.show;
$scope.$apply();
};
value.CloseClick = function() {
$scope.selected.show = false;
console.log("CloseClicked");
$scope.$apply();
};
this.push(value);
}, $scope.markers);
and then drawing markers on google map with Angular google maps
<ui-gmap-google-map center='map.center' zoom='map.zoom'>
<ui-gmap-markers models="markers" fit="true" coords="'self'" click="onClick">
</ui-gmap-markers>
<ui-gmap-window coords="selected" show="selected.show" closeClick="closeClick"><div>aga</div></ui-gmap-window>
</ui-gmap-google-map>
but when I click on the marker the onClick function doesn't fire. I'm new to Angular.js, but it looks like I have a problem with it (or maybe worse for me with JavaScript itself) and not with Angular Google Maps, but I'm not sure. Thanks for any help.
[UPDATE] Problem solved by using click="'onClick'"
insteadclick="onClick"
+3
source to share