map.setMyLocationEnabled()
April 20, 2018 ยท View on GitHub
Set true if you want to show the MyLocation control (blue dot).
map.setMyLocationEnabled(flag)
Parameters
| name | type | description |
|---|---|---|
| flag | boolean | true: show the myLocation control, false: hide it |
Demo code
<div class="map" id="map_canvas">
<span class="smallPanel"><button>current: map.myLocation = true</button></span>
</div>
map: GoogleMap;
isEnabled: any;
loadMap() {
this.map = GoogleMaps.create('map_canvas', {
controls: {
myLocationButton: true,
myLocation: true
}
});
}
onToggleChanged() {
this.isEnabled = !this.isEnabled;
this.map.setMyLocationEnabled(this.isEnabled);
}
