I’m new in Ionic and I have started a project using ionic with google maps, but a have some problems. My new code is with some bug i can’t fix or understanding.
This is my code:
ngOnInit(){
this.geolocation.getCurrentPosition().then((resp)=>{
this.position = new google.maps.LatLng(resp.coords.latitude, resp.coords.longitude);
});
}
ngAfterContentInit() {
this.map = new google.maps.Map(
this.mapElement.nativeElement,
{
center: this.position,
zoom: 13
});
}
ionViewDidLoad() {
google.maps.event.trigger(this.map,'resize');
}
The problem appear when i center the map, if i’m use the code above, then the map appear grey. But if i’m put the coordenates like, center: {lat: 0.000, lng: 0.000} . The map will appear with no problem, but i need to get the coordenates in real time. Someone can help me please?