showing results for - "how to get latitude and longitude from address in angular 6"
Cadence
06 Jun 2018
1getGeoLocation(address: string): Observable<any> {
2    console.log('Getting address: ', address);
3    let geocoder = new google.maps.Geocode();
4    return Observable.create(observer => {
5        geocoder.geocode({
6            'address': address
7        }, (results, status) => {
8            if (status == google.maps.GeocoderStatus.OK) {
9                observer.next(results[0].geometry.location);
10                observer.complete();
11            } else {
12                console.log('Error: ', results, ' & Status: ', status);
13                observer.error();
14            }
15        });
16    });
17}
18