Hi everyone, I’m making a test app with ionic 4.12
I inserted a Google map, using the cordova-plugin-googlemaps 2.6.2 plugin, I inserted a marker, which I visualize correctly. Here is the code used:
import { Component, OnInit } from '@angular/core';
import { NavController, NavParams } from '@ionic/angular';
import {
ToastController,
Platform
} from '@ionic/angular';
import {
GoogleMaps,
GoogleMap,
GoogleMapsEvent,
Marker,
GoogleMapsAnimation,
MyLocation,
HtmlInfoWindow
} from '@ionic-native/google-maps';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
@Component({
selector: 'app-mappa-all',
templateUrl: './mappa-all.page.html',
styleUrls: ['./mappa-all.page.scss'],
})
export class MappaAllPage implements OnInit {
public rs_coordinate_contenuti: Array<any> = [];
map: GoogleMap;
address: string;
constructor(
public toastCtrl: ToastController,
private platform: Platform,
public http_coordinate_contenuti: HttpClient,
public http_prodotti: HttpClient,
public navCTRL: NavController,
public router: Router
) { }
ngOnInit() {
this.platform.ready();
this.load_coordinate_contenuti();
}
// CARICAMENTO COORDINATE GEO DEI CONTENUTI
load_coordinate_contenuti(): void {
this.http_coordinate_contenuti.get('http://www.myapage.org/load_mappa_contenuti.php').subscribe((data_cont: any) => {
this.rs_coordinate_contenuti = data_cont;
// Caricamento mappa
this.map = GoogleMaps.create('map_canvas', {
camera: {
target: {
lat: 40.646624,
lng: 17.517737
},
zoom: 18,
tilt: 30
}
});
var marker = this.map.addMarker({
position: {lat: 40.64676, lng: 17.517753},
title: "Hello Cordova Google Maps for iOS and Android",
snippet: "This plugin is awesome!"
})
},
(error: any) => {
console.dir(error);
});
}
}
I wish that when the user displays the marker title, he can click on the text and be sent back to another page. How should I set the code?
I thank you for your attention and forgive my bad English