Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Reserve geocode : Cannot read property 'Geocoder' of null

$
0
0

@f3n2x wrote:

Hi

I encountered this error when tried Google Map Reserve Geocode. Any idea?

Unhandled Promise rejection: Cannot read property ‘Geocoder’ of null ; Zone: ; Task: Promise.then ; Value: TypeError: Cannot read property ‘Geocoder’ of null

See below my code:

import { GoogleMaps, GoogleMap, GoogleMapsEvent,
GoogleMapOptions, CameraPosition, MarkerOptions, Marker,
Geocoder,GeocoderRequest, LatLng, GeocoderResult
} from ‘@ionic-native/google-maps’;

export class GMapSearchPage {

@ViewChild(‘map’) mapElement: ElementRef;
map: any;
startP: string;
endP: string;
indicator: string;
dateTm : string;

constructor(private navCtrl: NavController, private navParams: NavParams
, private platform :Platform, private geolocation: Geolocation
, private geocoder: Geocoder) {
this.indicator=“start”;

}

   let req : GeocoderRequest = { position: new LatLng( 1.3563415021796763, 103.98829936981201) } ;

    Geocoder.geocode(req).then((results: GeocoderResult[])=>{
      let address = [
        (results[0].thoroughfare || "") + " " + (results[0].subThoroughfare || ""),
        results[0].locality
      ].join(", ");
      console.log("data_: ", address);

    })

Thank you

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>