Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
GoogleMap.isAvailable().then(() => {
this.map = new GoogleMap('map_canvas');
// this.map.on(GoogleMapsEvent.MAP_READY).subscribe(
// () => this.onMapReady(),
// () => alert("Error: onMapReady")
// );
// this.map.on(GoogleMapsEvent.MAP_READY).subscribe(
// (data: any) => {
// alert("GoogleMap.onMapReady(): ");
// },
// () => alert("Error: GoogleMapsEvent.MAP_READY")
// );
this.map.one(GoogleMapsEvent.MAP_READY).then((data: any) => {
alert("GoogleMap.onMapReady(): " + JSON.stringify(data));
this.platform.ready().then(()=> {
this.googleMap = new GoogleMap("gmap");
console.log("gmap is ", this.googleMap);
let myPosition = new GoogleMapsLatLng(43.536476, -79.7304218);
console.log("My position is", myPosition);
let markerOptions: GoogleMapsMarkerOptions = {
position: myPosition,
title: 'Custom thing'
};
//marker.showInfoWindow();
this.googleMap.on(GoogleMapsEvent.MAP_CLICK)
.map(data=>data)
.subscribe(
(data: any) => console.log("GoogleMap.onMapClick(): ", data)
);
private onPlatformReady(): void {
this.map = new GoogleMap('map_canvas');
this.mcontrol = new MarkerController(this.map);
this.map.one(GoogleMapsEvent.MAP_READY)
.then(() => this.onMapReady());
}
initMap() {
const element: HTMLElement = document.getElementById('map');
if (!this.map) {
this.map = new GoogleMap(element);
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
this.loadImagePlaces(this.map)
.then(coords => {
const filtered = coords.filter(coord => coord);
const bounds = filtered.map((coord: Coordinates) => {
return new GoogleMapsLatLng(coord.latitude, coord.longitude);
});
this.map.moveCamera({
target: bounds,
});
});
});
}
}