My current setup:view image description ...
google.maps.event.addListener(marker,'click',function() {
this.map.setZoom(15);
this.map.setCenter(marker.getPosition());
console.log('hello world');
this.presentAlert(); // ERROR core.js:9110 ERROR TypeError:
//this.presentAlert is not a function
});
...
What I'm aiming for:view image description
Expanded version of my code: ...
public addMarker(lat: number, lng: number) {
//let latLng = new google.maps.LatLng(lat, lng);
let latLng = new google.maps.LatLng(21.576, -158.271); // favorite hiking
// spot
let marker = new google.maps.Marker({
map: this.map,
animation: google.maps.Animation.DROP,
position: latLng
});
this.markers.push(marker); // gotta catch 'em all
google.maps.event.addListener(marker,'click',function() {
this.map.setZoom(15);
this.map.setCenter(marker.getPosition());
console.log('hello world');
this.presentAlert(); // ERROR core.js:9110 ERROR TypeError:
// this.presentAlert is not a function
});
}
presentAlert() {
this.alertCtrl.create({
header: 'Alert',
subHeader: 'Subtitle',
message: 'This is an alert message.',
buttons: ['OK']
}).then(alert=> {
alert.present();
});
}
...
I've attempted various solutions, but this approach seems most logical to me. Can anyone provide assistance? Thank you in advance.