I am using google maps with my angular application in following way.
const mapProp = {
center: new google.maps.LatLng(24.828844, 67.034527),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
this.map = new google.maps.Map(this.gmapElement.nativeElement, mapProp);
I am adding markers to my map in following way.
const marker = new google.maps.Marker({
position: latlng,
map: this.map,
$this: this,
title: 'Click to zoom',
icon: Constants.Image,
});
I am adding click listener to the marker in following way
marker.addListener('click', function() {
this.map.setZoom(15);
this.map.setCenter(marker.getPosition());
this.$this.showDetailview = true;
});
nIn the listener's call back function i am setting a component's variable showDetailview
to true by this.$this.showDetailview = true;
line. But it is not working. I am trying to show a div on basis on this variable but it is not working. Can anyone tell me if I am doing it right or not. If It is wrong please suggest some way to make a components variable to true inside the callback.