Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createMap() {
// TODO need to store/retrieve prevLoc in app preferences/local storage
let prevLoc = new LatLng(13.0768342, 77.7886087);
let mapOptions: GoogleMapOptions = {
camera: {
target: prevLoc,
zoom: 15,
tilt: 10
}
};
this.map = GoogleMaps.create('map', mapOptions);
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
console.log('--> ReportNewPage: Map is Ready To Use');
this.mapReady = true;
// https://stackoverflow.com/questions/4537164/google-maps-v3-set-single-marker-point-on-map-click
this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe( event => {
this.location = event[0];
console.log('--> ReportNewPage: User clicked location = ' + event[0]);
this.map.clear();
this.map.addMarker({
title: 'Selected location',
position: event[0]
}).then((marker: Marker) => {
this.autoFillAddress();
marker.showInfoWindow();
});
});
loadMap() {
console.log("loading Map");
this.map = GoogleMaps.create('map', {
controls: {
myLocation: true,
myLocationButton: false,
mapToolbar: false,
compass: true,
}
});
this.map.one(GoogleMapsEvent.MAP_READY).then(() => this.zoomToMyLocation());
}
/**
function () {
var _this = this;
console.log("loading Map");
this.map = GoogleMaps.create('map', {
controls: {
myLocation: true,
myLocationButton: false,
mapToolbar: false,
compass: true,
}
});
this.map.one(GoogleMapsEvent.MAP_READY).then(function () { return _this.zoomToMyLocation(); });
};
/**
loadMap(): any {
console.log("loading Map");
this.map = GoogleMaps.create('map', {
controls: {
myLocation: true,
myLocationButton: false,
mapToolbar: false,
compass: true,
}
});
this.map.one(GoogleMapsEvent.MAP_READY).then(() => this.zoomToMyLocation());
}
loadMap() {
let loc = new LatLng(this.grievance.geoLocation.coordinates[1], this.grievance.geoLocation.coordinates[0]);
let mapOptions: GoogleMapOptions= {
camera: {
target: loc,
zoom: 15,
tilt: 10
}
};
this.map = GoogleMaps.create('map', mapOptions);
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
this.map.addMarker({
title: 'Problem Location',
position: loc
}).then((marker: Marker) => {
marker.showInfoWindow();
}).catch(err => {
console.log(err);
});
});
}
}
loadMap() {
console.log("loading Map");
this.map = GoogleMaps.create('map', {
controls: {
myLocation: true,
myLocationButton: false,
mapToolbar: false,
compass: true,
}
});
this.map.one(GoogleMapsEvent.MAP_READY).then(() => this.zoomToMyLocation());
}
/**
private loadMap(): any {
this.map = GoogleMaps.create('map', {
mapType: this.mapType,
controls: {
myLocation: true,
myLocationButton: false,
mapToolbar: false,
compass: true,
}
});
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
this.mapReady = true;
if (this.zoomToLocationOnMapReady) {
this.zoomToMyLocation(this.zoom);
}
});
}
'API_KEY_FOR_BROWSER_RELEASE': 'API-KEY',
'API_KEY_FOR_BROWSER_DEBUG': 'API-KEY'
});
let mapOptions: GoogleMapOptions = {
camera: {
target: {
lat: 13.0380523,
lng: 80.21371
},
zoom: 18,
tilt: 30
}
};
this.map = GoogleMaps.create('map', mapOptions);
let marker: Marker = this.map.addMarkerSync({
title: 'Ionic',
icon: 'blue',
animation: 'DROP',
position: {
lat: 13.0380523,
lng: 80.21371
}
});
marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => {
alert('clicked');
});
}
}